[Python-bugs-list] [ python-Bugs-591104 ] os.tmpfile() can fail on win32
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 05 Aug 2002 07:23:25 -0700
Bugs item #591104, was opened at 2002-08-05 14:23
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=591104&group_id=5470
Category: Windows
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Joseph barillari (jdbarillari)
Assigned to: Tim Peters (tim_one)
Summary: os.tmpfile() can fail on win32
Initial Comment:
I've discovered what appears to be a bug in Python 2.2.1
on Win32. I'm
using the 2.2.1 build that I downloaded from python.org.
I'm running
Windows 2000.
If os.tmpfile() is exceuted when the CWD is a UNC path,
the base of
which is not writeable by the current user, tmpfile will
fail. tempfile.TemporaryFile will work, so I suspect this is
a bug in os.tmpfile().
For example:
C:\>pwd
/cygdrive/c #I use cygwin
C:\>bash # I have to use bash; the DOS shell doesn't
support UNC paths
bash: .bashrc: No such file or directory
bash-2.05a$ cd //bopp/jbarilla
bash-2.05a$ pwd
//bopp/jbarilla
bash-2.05a$ python
Python 2.2.1 (#34, Apr 9 2002, 19:34:33) [MSC 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more
information.
>>> import os; os.tmpfile()
<open file '<tmpfile>', mode 'w+' at 0x007762C0> # It
works.
>>> ^Z
If I chmod 555 //bopp/jbarilla (from unix via NFS;
incidentally,
"chmod 555 ." from cygwin is ineffectual), then tmpfile
fails:
bash-2.05a$ pwd
//bopp/jbarilla
bash-2.05a$ python
Python 2.2.1 (#34, Apr 9 2002, 19:34:33) [MSC 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more
information.
>>> import os; os.tmpfile()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OSError: [Errno 13] Permission denied # Oops.
# However, tempfile.TemporaryFile works:
>>> import tempfile; tempfile.TemporaryFile()
<open file 'c:\DOCUME~1\jbarilla\LOCALS~1
\Temp\~1880-0', mode 'w+b' at 0x00779B00>
--Joe
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=591104&group_id=5470