[issue26385] the call of tempfile.NamedTemporaryFile fails and leaves a file on the disk

Eryk Sun report at bugs.python.org
Sat Feb 20 09:00:46 EST 2016


Eryk Sun added the comment:

> By your explanation, it sounds like it would be better 
> to call unlink() before close().

Sorry, I was responding in general, because I thought you meant unlink would fail like it would for most open files on Windows, because the CRT normally doesn't open files with delete sharing. But I see what you meant now. Yes, the order needs to be reversed as unlink() and then close() for this to work. Doing the close first does raise a FileNotFoundError.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26385>
_______________________________________


More information about the Python-bugs-list mailing list