[python-win32] File Locking: HELP
Sheila King
sheila@thinkspot.net
Sun, 26 Aug 2001 09:36:55 -0700
OK, after a discussion with Tim Peters and others in comp.lang.python
about file locking and msvcrt, I've decided that I really won't be able
to use msvcrt for successful file locking.
So, I'm going to try to use the win32 extensions. I have a book on
order, but it will be a while until it gets here.
In the meantime, I was trying to run the portalocker.py code that is
here:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203
And I get this error, when running it as __main__:
Traceback (most recent call last):
File "E:\programs\LearningPython\fileIO\portalocker.py", line 107, in
?
portalocker.lock(log, portalocker.LOCK_EX)
File "E:\programs\LearningPython\fileIO\portalocker.py", line 88, in
lock
win32file.LockFileEx(hfile, flags, 0, 0xffff0000, __overlapped)
pywintypes.api_error: (120, 'LockFileEx', 'This function is only valid
in Win32 mode.')
Any ideas what might be causing this?
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/