Help: using msvcrt for file locking
Bengt Richter
bokr at accessone.com
Sun Aug 26 07:44:17 EDT 2001
On Sun, 26 Aug 2001 06:54:16 GMT, Sheila King <sheila at spamcop.net> wrote:
>On Sat, 25 Aug 2001 23:25:42 -0400, "Tim Peters" <tim.one at home.com>
>wrote in comp.lang.python in article
><mailman.998796398.21253.python-list at python.org>:
>
>:[Sheila King]
>:> I'm trying to do some file locking on Windows. I'm running Win98, but I
>:> hope that the methods in the msvcrt module will work OK on any win32?
>:
>:msvcrt directly exposes some library functions supplied by, and unique to,
>:Microsoft. So, like it or not (I don't like it myself <wink>), Microsoft is
>:the only entity who can answer questions about them with authority. FWIW,
>:the docs MS supplied with MSVC 6 say their _locking function works under
>:"Win 95, Win NT", which *usually* means "everything after Win 3.1".
>
http://starship.python.net/crew/jjkunce/python/ntposixfile.py
might be useful?
Note from my other post: Microsoft example code for _locking uses
_sopen rather than fopen (or _open). The s in _sopen is for shared
file access, so I wonder if python's builtin open is affected, since
it uses fopen.
The ntposixfile.py seems to go to __builtin__.open() as well, though,
so if _sopen does something different and required, the same problem
should appear. Hard to believe there wouldn't be more noise on google
about it though, if _locking didn't work with fopen, unless people
just quietly give up and go on to the win32 api...
More information about the Python-list
mailing list