Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language

Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Python Programming Language

Invalid argument with fcntl.fcntl

I am trying to use the advisory locking with fcntl over NFS (thus, me
choosing fcntl instead of flock and friends).

I have the following code:
lockdata = struct.pack ("hhllhh", fcntl.F_RDLCK, 0, 0, 0, 0, 0)
print self.fd, type (self.fd), len (lockdata), type (lockdata)
ret = fcntl.fcntl (self.fd, fcntl.F_GETLK, lockdata)

when this code executes, I always get the following:

<open file 'test.py', mode 'a' at 0xb7e99458> <type 'file'> 16 <type
'str'> Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "filelock.py", line 154, in _get_lock_state_nfs
    ret = fcntl.fcntl (self.fd, fcntl.F_GETLK, lockdata)
IOError: [Errno 22] Invalid argument

If I execute the same code in the Python interpreter (replacing self.fd
with an open file object), it work.

Can anyone shed some light on why this code would produce that error?

Mitko Haralanov                                  m@qlogic.com
Senior Software Engineer                             650.934.8064
System Interconnect Group                   http://www.qlogic.com

FORTRAN is a good example of a language which is easier to parse
using ad hoc techniques.
                -- D. Gries
                [What's good about it?  Ed.]

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc