On my machine Linux machine ulimit -n gives 1024. This code:
ulimit -n
1024
from tempfile import mkstemp for n in xrange(1024 + 1): f, path =
Use os.close() to close the file descriptor:
import os from tempfile import mkstemp # Open a file fd, path = mkstemp() # Close opened file os.close( fd )