Skip to content

Instantly share code, notes, and snippets.

@lvsl-deactivated
Created November 16, 2010 04:44
Show Gist options
  • Save lvsl-deactivated/701434 to your computer and use it in GitHub Desktop.
Save lvsl-deactivated/701434 to your computer and use it in GitHub Desktop.
How to close all files except stdin,stdout,stderr in python
# In case you use some sloppy daemon starter script do this.
os.closerange(3, rosource.RLIMIT_NOFILE)
@bAndie91
Copy link

bAndie91 commented Jan 11, 2017

os.closerange(3, resource.getrlimit(resource.RLIMIT_NOFILE)[0])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment