Guest User

Untitled

a guest
Oct 17th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import nuke, os, subprocess
  2.  
  3. def get_open_files():
  4. found_knobs = []
  5. found_files = []
  6.  
  7. for node in nuke.allNodes():
  8. try:
  9. found_knobs.append(node.knob('file').getValue())
  10. except:
  11. pass
  12.  
  13. for i in found_knobs:
  14. for name in os.listdir(os.path.dirname(i)):
  15. filepath = os.path.join(os.path.dirname(i), name)
  16. if os.path.isfile(filepath) and filepath not in found_files:
  17. found_files.append(filepath)
  18.  
  19. return len(found_files)
  20.  
  21. def get_ulimit():
  22. process = subprocess.check_output("ulimit -s", stderr=subprocess.STDOUT, shell=True)
  23. return int(process.strip())
  24.  
  25. if get_open_files() > get_ulimit():
  26. print 'Reached Ulimit'
  27. else:
  28. print 'Still room in ulimit'
Add Comment
Please, Sign In to add comment