Ensuring exclusive file locks on UNIX platforms

Sean Reifschneider jafo-pythonlist at tummy.com
Sun Jan 21 14:54:34 EST 2001


On Sun, Jan 21, 2001 at 05:06:04PM +0100, Morten W. Petersen wrote:
>Is there a way to ensure exclusive access to the file using
>some existing python module, or do I need to add a .<filename>.lock
>'hack' ?

There are various locking calls available in the standard library.
Depending on what flavor of Unix and what file-system you are using,
some of them may be more appropriate than others...  I have a dot-locking
module that I've used fairly successfully.  It's called "jlock.py" and
is at ftp://ftp.tummy.com/pub/tummy/Python/jlock.py

Sean
-- 
 If I built a talking Barbie, it would say "Date math is hard."
                 -- Sean Reifschneider, 2000
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python




More information about the Python-list mailing list