Start application & continue after app exits

Mike Meyer mwm at
Thu Jun 9 23:49:22 CEST 2005

"guy lateur" <guy.lateurNNOOSSPPAAMM at> writes:

>>>Also note that this method of creating tempfiles is technically unsafe,
>>>as it is theoretically possible that another process would create a file
>>>of the same name in the same directory and then try to use it, resulting
>>>in a race condition between the two processes. This is practically
>>>unlikely, however, and I'm a pragmatist.
> I see what you mean, but wouldn't a call to open(fn, 'w') on a filename 
> that's in use (for reading or writing) result in an error condition or 
> something? I'm a noob, btw.

Not necessarily - it depends on the OS. Unix is quite happy to let
multiple processes read/write a file at the same time.

FWIW, this also means that the methodology as outlined is
insecure. Some other program can read the temporary file as it exists
on the disk, thus disclosing it's contents to unauthorized readers.

Mike Meyer <mwm at>
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

More information about the Python-list mailing list