portalocker in Win98

James Kew james.kew at btinternet.com
Wed Jan 15 09:37:22 CET 2003

Thomas Heller wrote:
> 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.

I suspect portalocker uses LockFileEx rather than LockFile as only
LockFileEx supports a blocking lock (ie, block until the lock becomes
available) and only LockFileEx supports shared/exclusive locking.

I have added a comment to the Python Cookbook entry for portalocker.

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

Again, this doesn't support blocking locks -- the docs say it polls for a
lock 10 times at 1-second intervals before giving up. It also has the rather
odd property of locking for a range of bytes in the file starting from the
current file position.

I don't really know what Roundup's locking requirements are, so maybe this
is sufficient?

It'd be nice if Roundup could run on Win98, not least because it was my
Roundup installation (on NT) that Vic saw, liked, and had evangelised at him
and it's a little embarassing that he now can't run it...

James Kew
james.kew at btinternet.com

More information about the Python-list mailing list