On 7/06/2006 3:57 PM, Dennis Lee Bieber wrote: > On Wed, 07 Jun 2006 09:56:13 +1000, John Machin <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> The dir, prefix and suffix parameters are passed to mkstemp(). > <snip> >> So I'd be thinking about using the (deprecated) mktemp() instead, > > I think you passed over the mkstemp() variation. Granted, it, too, > returns an opened file, along with the full pathname of the file, but it > requires the caller to handle eventual disposal of the file. > > Merely close the opened file; pass the pathname to the subprocess, > await completion of subprocess, reopen the file for use in Python... > Then at the end, close the file and use the pathname to delete the file > from the system.
I passed over mkstemp() because (according to my reading of the manual), mkstemp() requires an *extra* step (close the file), leaving the situation then *exactly* the same as with mktemp() i.e. some pirate process may molest the file before the caller's child process can open the file. Cheers, John -- http://mail.python.org/mailman/listinfo/python-list