file.close() does not really close under Windows?
Dani
daninanz at gmail.com
Thu Dec 17 07:54:36 EST 2009
Is it correct that low-level file handles are not being closed after
doing
fd = open(filepath)
fd.close()
If so, what is the rationale?
This seems to result in system errors when trying to (re-)move or
reopen "closed" files, as well as when opening (and closing) too many
files under Windows.
A workaround seems to be
os_fd = os.open(filepath)
fd = os.fdopen(os_fd)
os.close(os_fd)
More information about the Python-list
mailing list