J
John Machin
Hi,
Here's what's happening:
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 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 <module>
OSError: [Errno 13] Permission denied
but tempfile.mkstemp() works:
(3, 'c:\\docume~1\\sjm\\locals~1\\temp\\tmpnfuk9i')
This is Windows XP Pro SP2. The user with the problem is _not_ an
administrator. It works OK when logged on as an administrator. I am
using the mode which enables having multiple users logged on and
switching between them.
The problem happens with Pythons back to 2.2. Python 2.1 on Windows
doesn't seem to have a tmpfile() function in the os module.
On a Windows 2000 SP4 box, with a "Power User" [part way between
administrator and vanilla user] Python 2.3.5 os.tmpfile() works OK.
AFAICT Win XP doesn't have this intermediate level of user.
Questions:
1. Before I start checking what permissions who has to do what to
which, what directory is it likely to be trying to open the temp file
in? C:\WINDOWS\TEMP....?
2. What is the general advice about whether to use os.tmpfile() or the
functions in the tempfile module? I'm presuming that as os.tmpfile()
is ultimately calling tmpfile() in the C stdio library, nobody would
have gone to the effort of making the tempfile module just to
reproduce stdio functionality, but AFAICT there's no guidance in the
docs. Maybe I should be talking to the authors of the package that is
using os.tmpfile()
TIA for any clues,
John
Here's what's happening:
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 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 <module>
OSError: [Errno 13] Permission denied
but tempfile.mkstemp() works:
(3, 'c:\\docume~1\\sjm\\locals~1\\temp\\tmpnfuk9i')
This is Windows XP Pro SP2. The user with the problem is _not_ an
administrator. It works OK when logged on as an administrator. I am
using the mode which enables having multiple users logged on and
switching between them.
The problem happens with Pythons back to 2.2. Python 2.1 on Windows
doesn't seem to have a tmpfile() function in the os module.
On a Windows 2000 SP4 box, with a "Power User" [part way between
administrator and vanilla user] Python 2.3.5 os.tmpfile() works OK.
AFAICT Win XP doesn't have this intermediate level of user.
Questions:
1. Before I start checking what permissions who has to do what to
which, what directory is it likely to be trying to open the temp file
in? C:\WINDOWS\TEMP....?
2. What is the general advice about whether to use os.tmpfile() or the
functions in the tempfile module? I'm presuming that as os.tmpfile()
is ultimately calling tmpfile() in the C stdio library, nobody would
have gone to the effort of making the tempfile module just to
reproduce stdio functionality, but AFAICT there's no guidance in the
docs. Maybe I should be talking to the authors of the package that is
using os.tmpfile()
TIA for any clues,
John