Guest User

Untitled

a guest
Jan 19th, 2020
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import os
  4.  
  5. p = '/proc/pressure/memory'
  6. s = 'some 140000 1000000'
  7.  
  8. try:
  9.  
  10. fd1= os.open(p, os.O_RDWR | os.O_NONBLOCK, mode=0o777, dir_fd=None)
  11. print(fd)
  12.  
  13. s2 = s.encode()
  14. print(type(s2), s2)
  15.  
  16. n = os.write(fd1, s2)
  17. print(n)
  18.  
  19. except Exception as e:
  20. print(e)
  21.  
  22. finally:
  23. os.close(fd)
Advertisement
Add Comment
Please, Sign In to add comment