This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: tempfile.NamedTemporaryFile does not accept the delete= parameter on Windows
Type: behavior Stage:
Components: Versions: Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, stutzbach
Priority: normal Keywords:

Created on 2009-06-28 20:24 by stutzbach, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (7)
msg89782 - (view) Author: Daniel Stutzbach (stutzbach) (Python committer) Date: 2009-06-28 20:24
Likely affects Python 2.7 and Python3.x as well, but I have not checked.

Under Windows:
>>> tempfile.NamedTemporaryFile('w', delete = False)
TypeError: NamedTemporaryFile() got an unexpected keyword argument 'delete'

Under Unix:
>>> tempfile.NamedTemporaryFile('w', delete=True)
<open file '<fdopen>', mode 'w' at 0x7ff199d0>
msg89821 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-06-29 09:50
Are you sure to use the same version? 'delete' is new in 2.7.
msg89835 - (view) Author: Daniel Stutzbach (stutzbach) (Python committer) Date: 2009-06-29 13:44
Yes, I'm sure.  See below.

Also, the 2.6 docs mention it as being new in 2.6:
http://docs.python.org/library/tempfile.html

Cashew:~$ python2.6
Python 2.6.2 (r262:71600, Apr 15 2009, 07:20:39)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tempfile
>>> tempfile.NamedTemporaryFile('w', delete=True)
<open file '<fdopen>', mode 'w' at 0x7ff1e480>
>>>
msg89841 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-06-29 14:31
Which version do you use on Windows?
msg89843 - (view) Author: Daniel Stutzbach (stutzbach) (Python committer) Date: 2009-06-29 14:39
C:\>c:\python26\python
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tempfile
>>> tempfile.NamedTemporaryFile('w', delete=true)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'true' is not defined
>>>

Hope that helps :)
msg89844 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-06-29 14:44
Well, please try with a capitalized "True"...
msg89848 - (view) Author: Daniel Stutzbach (stutzbach) (Python committer) Date: 2009-06-29 15:09
Oy vey.  That's what I get for not reading carefully.  And in my
original example it seems I had a python 2.5 install wandering around in
my path.  My apologies.
History
Date User Action Args
2022-04-11 14:56:50adminsetgithub: 50606
2009-06-29 15:09:10stutzbachsetstatus: open -> closed

messages: + msg89848
2009-06-29 14:44:05amaury.forgeotdarcsetmessages: + msg89844
2009-06-29 14:39:14stutzbachsetmessages: + msg89843
2009-06-29 14:31:10amaury.forgeotdarcsetmessages: + msg89841
2009-06-29 13:44:45stutzbachsetstatus: pending -> open

messages: + msg89835
2009-06-29 09:50:54amaury.forgeotdarcsetstatus: open -> pending

nosy: + amaury.forgeotdarc
messages: + msg89821

resolution: not a bug
2009-06-28 20:24:25stutzbachcreate