How to determine if a file is busy?

Alex Martelli aleaxit at
Fri Oct 8 13:54:03 CEST 2004

Benjamin Niemann <b.niemann at> wrote:

> How about writing the data to a file '' and when you are finished,
> delete 'mydata' and rename '' to 'mydata'.
> This way the python script will always get 'complete' files (and sometimes no
> file at all, when it come in between rm and mv ...)

I believe that 'mv' on Mac OS X, within a normal filesystem, is an
atomic operation anyway -- so, so need to rm first then mv.  On the
other hand, this would give no intrinsic guarantee that the datafile
previously produced HAS been consumed/recorded before it's removed.


More information about the Python-list mailing list