No flock() in Windows!?
Ben Hutchings
ben.hutchings at roundpoint.com
Mon May 7 21:30:24 EDT 2001
David LeBlanc <whisper at oz.nospamnet> writes:
> In article <7kzt29he.fsf at pobox.com>, jdf at pobox.com says...
> > I'm fairly new to Python, and have been enjoying it.
> >
> > In rewriting an old Perl script into Python, I was staggered to
> > discover that there is simply no fcntl support at all on the Windows
> > platform. Such support is entirely platform-transparent in Perl, and
> > I don't know how to work without it!
> >
> > How do you folks write cross-platform scripts that safely provide for
> > advisory locking?
> >
> > I have searched the library docs and FAQ, I have searched the web and
> > the Google Usenet archive. If I missed something, pointers will be
> > gladly followed.
> >
> Windows supports locking down to the byte level on files using the
> _locking() runtime library function.
<snip>
That's a VC++ function, not a Windows function. The Win32 API has the
functions (Un)LockFile(Ex), which are available through the win32api
module.
--
Any opinions expressed are my own and not necessarily those of Roundpoint.
More information about the Python-list
mailing list