File locking

Barry A. Warsaw bwarsaw at
Tue Jun 1 16:34:38 CEST 1999

>>>>> "AMK" == A M Kuchling <amk1 at> writes:

    AMK> What is the correct solution for doing file locking in Python
    AMK> programs?

You might want to look at Mailman's module.  The doc string

    Portable (?) file locking with timeouts.  
    This code should work with all versions of NFS.
    The algorithm was suggested by the GNU/Linux open() man page.  Make
    sure no malicious people have access to link() to the lock file.

It's also been banged on quite a bit, although I'll make no guarantees 
that it's bug free.  It's probably pretty close tho'.


More information about the Python-list mailing list