portalocker in Win98

Thomas Heller theller at python.net
Tue Jan 14 16:20:53 EST 2003


Richard Jones <rjones at ekit-inc.com> writes:

> On Wed, 15 Jan 2003 6:10 am, Robin Becker wrote:
> > In article <fe35b211.0301140932.62d3d334 at posting.google.com>, Vic
> > <vic at innocent.com> writes
> > >I'm brand new to Python. I saw Roundup working at work, and decided to
> > >try an installation at home.
> > >
> > >The initial testing (run_tests) fails with 95 errors - these all
> > >appear to be file-locking problems. I've scoured the web, and found
> > >out about the unsupported file-lock stuff used by portalocker.py.
> > >
> > >So - has anyone got this going on Win98? Is there a potted solution I
> > >can use, or have I got loads of re-coding to do (I'm a C programmer,
> > >so thst's not going to happen any time soon...)
> >
> > There's another thread about this right now and some have suggested
> > using a directory lock file to avoid certain NFS problems.
> 
> The issue at hand is that the portalocker code uses the win32 API to do 
> locking on windows, but win98 doesn't support it. Or something. I'm not 
> completely sure. I do know that NFS doesn't come into it...
> 

The problem is that portalocker uses the functions LockFileEx and
UnlockFileEx, which are documented in MSDN as only winNT/2000/XP. The
functions LockFile and UnlockFile (are they exposed by win32all?) are
also available on Win95/98/Me.

But even they may not be needed, there's the little known msvcrt module
included in standard Python, which also has a locking function.
I never tried it, though. 

Thomas




More information about the Python-list mailing list