Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import nuke, os, subprocess
- def get_open_files():
- found_knobs = []
- found_files = []
- for node in nuke.allNodes():
- try:
- found_knobs.append(node.knob('file').getValue())
- except:
- pass
- for i in found_knobs:
- for name in os.listdir(os.path.dirname(i)):
- filepath = os.path.join(os.path.dirname(i), name)
- if os.path.isfile(filepath) and filepath not in found_files:
- found_files.append(filepath)
- return len(found_files)
- def get_ulimit():
- process = subprocess.check_output("ulimit -s", stderr=subprocess.STDOUT, shell=True)
- return int(process.strip())
- if get_open_files() > get_ulimit():
- print 'Reached Ulimit'
- else:
- print 'Still room in ulimit'
Add Comment
Please, Sign In to add comment