F_GETLK Working?

Jeff Epler jepler at unpythonic.net
Wed Mar 17 10:09:09 EST 2004


Because strings are immutable, this line
    rv = fcntl.fcntl(lock_file, fcntl.F_GETLK, flk)
can't modify the value of flk.  Instead, the value you want is returned
in rv.  Try changing the last 2 lines to
    locked = struct.unpack('hhllhl', rv)[0]
    print locked
on my system, this prints 2, which is the value of F_UNLCK.

Jeff




More information about the Python-list mailing list