[issue1390197] tempfile misses usecase which requirs renaming

Giampaolo Rodola' report at bugs.python.org
Wed Jun 4 04:54:18 CEST 2008


Giampaolo Rodola' <billiejoex at users.sourceforge.net> added the comment:

If you mean "renaming the temporary file while it is still opened" I see
2 reasons for not doing that:

- On Windows this is not possible since files remains locked as long as
you close() them.

- open().name and tempfile.NamedTemporaryFile().name attributes are not
reliable since they remains the same even after the file renaming.
>>> import os
>>> f = open('1', 'w')
>>> os.rename('1', '2')
>>> f.name
1

----------
nosy: +giampaolo.rodola

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


More information about the Python-bugs-list mailing list