Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-11-03 Thread skip
skip> Okay, this is up on my website: skip> http://www.webfast.com/~skip/python/ And on PyPI: http://pypi.python.org/pypi/lockfile/ Skip ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-

Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-11-01 Thread skip
> The API and almost all test cases are defined in a _FileLock base > class. You could (in theory at least) subclass it to provide locking > through some other shared resource like a database and not have to > write and or many other test cases. Okay, this is up on my website:

Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-10-29 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Oct 26, 2007, at 4:10 PM, [EMAIL PROTECTED] wrote: > > Barry> I don't think any one solution will work for everybody. > I'm not > Barry> even sure we can define a common API a la the DBAPI, but if > Barry> something were to make it i

Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-10-26 Thread skip
Barry> I don't think any one solution will work for everybody. I'm not Barry> even sure we can define a common API a la the DBAPI, but if Barry> something were to make it into the standard distribution, that's Barry> the direction I'd go in. I've been working on a lockfile module

Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-10-26 Thread M.-A. Lemburg
On 2007-10-26 05:41, Barry Warsaw wrote: > On Oct 22, 2007, at 11:30 PM, [EMAIL PROTECTED] wrote: > >> It's not clear that any of these implementations is going to be >> perfect. >> Maybe none ever will be. > > I would agree with this. You write a program and know you need to > implement som

Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-10-25 Thread Martin v. Löwis
> I don't think file locking will ever work over NFS, since > it's a stateless protocol by design NFS is stateless, but the NFS locking protocol (NLM) is not. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailm

Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-10-25 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Oct 22, 2007, at 11:30 PM, [EMAIL PROTECTED] wrote: > It's not clear that any of these implementations is going to be > perfect. > Maybe none ever will be. I would agree with this. You write a program and know you need to implement some kind

Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-10-22 Thread skip
>> I'm always daunted by the prospect of trying to implement file >> locking. Barry> If you want something like this, you might start by looking at Barry> Mailman's LockFile.py. If I interpret the Python documentation for os.link correctly, the scheme used by Mailman won't work o

Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-10-22 Thread Jean-Paul Calderone
On Tue, 23 Oct 2007 01:11:39 +0100, Jon Ribbens <[EMAIL PROTECTED]> wrote: >On Tue, Oct 23, 2007 at 12:29:35PM +1300, Greg Ewing wrote: >> [EMAIL PROTECTED] wrote: >> > Does fcntl.flock work over NFS and SMB and on Windows? >> >> I don't think file locking will ever work over NFS, since >> it's a s

Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-10-22 Thread Jon Ribbens
On Tue, Oct 23, 2007 at 12:29:35PM +1300, Greg Ewing wrote: > [EMAIL PROTECTED] wrote: > > Does fcntl.flock work over NFS and SMB and on Windows? > > I don't think file locking will ever work over NFS, since > it's a stateless protocol by design, and locking would > require maintaining state on th

Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-10-22 Thread Jon Ribbens
On Tue, Oct 23, 2007 at 12:16:41PM +1300, Greg Ewing wrote: > [EMAIL PROTECTED] wrote: > > This interface follows the completely stupid semantics of System V and > > IEEE Std 1003.1-1988 (``POSIX.1'') that require that all locks > > associated with a file for a given process are removed

Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-10-22 Thread Greg Ewing
[EMAIL PROTECTED] wrote: > Does fcntl.flock work over NFS and SMB and on Windows? I don't think file locking will ever work over NFS, since it's a stateless protocol by design, and locking would require maintaining state on the server. -- Greg ___ Pytho

Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-10-22 Thread Greg Ewing
[EMAIL PROTECTED] wrote: > This interface follows the completely stupid semantics of System V and > IEEE Std 1003.1-1988 (``POSIX.1'') that require that all locks > associated with a file for a given process are removed when any file > descriptor for that file is closed by that proc

Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-10-22 Thread Benji York
Barry Warsaw wrote: > On Oct 22, 2007, at 8:15 AM, [EMAIL PROTECTED] wrote: > >> I'm always daunted by the prospect of trying to implement file >> locking. > If you want something like this, you might start by looking at > Mailman's LockFile.py. Also related is the very simple zc.lockfile:

Re: [Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-10-22 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Oct 22, 2007, at 8:15 AM, [EMAIL PROTECTED] wrote: > I'm always daunted by the prospect of trying to implement file > locking. > This just came up again in SpamBayes where we have never protected our > pickle files from corruption when multiple p

[Python-Dev] Does Python need a file locking module (slightly higher level)?

2007-10-22 Thread skip
I'm always daunted by the prospect of trying to implement file locking. This just came up again in SpamBayes where we have never protected our pickle files from corruption when multiple processes access them simultaneously. The presence of networked file systems and platform-independent locks mak