"guy lateur" <[EMAIL PROTECTED]> 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 -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list