msvcrt, open_osfhandle, locking

Roger Baklund charoger at online.no
Tue Feb 22 15:44:47 EST 2000


Hi,

I'm trying to use msvcrt.open_oshandle() to get a handle so I can lock a
file using msvcrt.locking(), but it won't work.

I keep getting "TypeError: illegal argument type for built-in operation".

The documentation says the second parameter "shold be a bit-wise OR of
os.O_APPEND, os.O_RDONLY, and os.O_TEXT". os.O_TEXT equals 16384,
os.O_APPEND equals 8, and os.O_RDONLY equals 0.

import msvcrt
import os
f=open("somefile.txt")
fh=msvcrt.open_osfhandle(f,os.O_TEXT)

Same error occurs if I use 16384 directly.

Does anyone know what I am doing wrong?

--
Roger





More information about the Python-list mailing list