msvcrt, open_osfhandle, locking
qwe
rbaklundNOrbSPAM at hotmail.com.invalid
Wed Feb 23 05:34:27 EST 2000
In article <68Hs4.1435$LX4.4374 at news-
server.bigpond.net.au>, "Mark Hammond"
<mhammond at skippinet.com.au> wrote:
>Oops - meant "locking function in msvcrt module"
Hmmm. Do you have an example? I can't get it to work.
The documentation says: "locking (fd, mode, nbytes)
Lock part of a file based on a file descriptor from the C
runtime. Raises IOError on failure. "
and for open_osfhandle: "open_osfhandle (handle, flags)
Create a C runtime file descriptor from the file handle handle."
It seems to me that open_osfhandle() is used to get a file
descriptor based on a file handle, and the locking() function
needs this file descriptor?
When I try to use the locking() function on a file handle
returned by open, I still get "TypeError: illegal argument
type...", but if I use dummy data (locking(1,1,1)) in stead of
the file handle, I get "IOError: [Errno 9] Bad file descriptor",
so I asume you are right about the handle...
What do I use for 'mode' in the locking() function?
And what do I use for 'nbytes' if I want to lock the entire
file? The filesize?
--
Roger
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
More information about the Python-list
mailing list