file locking

Steve Purcell stephen_purcell at yahoo.com
Mon Mar 26 03:56:55 EST 2001


deadmeat wrote:
> How do I lock a file on opening it?  the bultin open() only allows me to set
> the read/write mode, not any deny modes.

On Unix, look at the 'flock' function in the module 'fcntl'.

You can also try the 'posixfile' module -- posixfile objects support locking.

-Steve

-- 
Steve Purcell, Pythangelist
Get testing at http://pyunit.sourceforge.net/
Any opinions expressed herein are my own and not necessarily those of Yahoo




More information about the Python-list mailing list