On Feb 11, 4:33 pm, "John Machin" <[EMAIL PROTECTED]> wrote: > On Feb 11, 4:15 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > En Sun, 11 Feb 2007 01:57:52 -0300, John Machin <[EMAIL PROTECTED]> > > escribió: > > > > | >>> os.tmpfile() > > > Traceback (most recent call last): > > > File "<stdin>", line 1, in <module> > > > OSError: [Errno 13] Permission denied > > > > 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....? > > > You could analyze the source, > > I have already followed the twisty little passages: os.tmpfile() is > really nt.tempfile(), but there is no Modules/ntmodule.c (Modules/ > posixmodule.c does a Jekyll & Hyde trick). (nt|posix)module calls > tmpfile(), which is (as I mentioned) in the C stdio library. How can I > analyse the source of that? Have Microsoft had a rush of blood to the > head and gone open source overnight?? > > > but usually I find easier to use FILEMON:http://www.sysinternals.com > > Thanks, I'll try that.
While Filemon is still alive, it's been superceded by Procmon, which combines filemon + regmon + plus new goodies. I tried procmon. And the result of an administrator user doing os.tmpfile(): 281773 4:50:14.8607126 PM python.exe 2716 CreateFile C:\t2ks SUCCESS Access: Generic Read/Write, Delete, Disposition: Create, Options: Synchronous IO Non-Alert, Non-Directory File, Delete On Close, Attributes: N, ShareMode: Read, Write, Delete, AllocationSize: 3,184,748,654,057,488,384 [big snip] *** AARRGGHH It's creating the file in the *ROOT* directory *** A quick google for "tmpfile root directory" reveals that this is a "popular" problem on Windows. See e.g. http://bugs.mysql.com/bug.php? id=3998 which has several users corroborating the story, plus this handy hint: """ But MSDN says (ms-help://MS.MSDNQTR.2003APR.1033/vclib/html/ _crt_tmpfile.htm): ------- The tmpfile function creates a temporary file and returns a pointer to that stream. The temporary file is created in the root directory. To create a temporary file in a directory other than the root, use tmpnam or tempnam in conjunction with fopen. """ I wonder why my environment has entries for TMP and TEMP (both pointing to the same path, and it sure ain't the root directory) -- must be one of those "haha fooled you" tricks :-( Regards, John -- http://mail.python.org/mailman/listinfo/python-list