473,395 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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?
Thanks

--
Mitko Haralanov mi***@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.]
Jun 6 '07 #1
0 1782

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Pierre Rouleau | last post by:
Hi all! I am using Python 2.3.1 on Win32 (NT, 2000). Whenever a file imports the standard tempfile module, Python 2.3.1 issues the following warning: C:\Python23\lib\fcntl.py:7:...
0
by: Ryan Grow | last post by:
Hi, I'm trying to use fcntl to set an existing file descriptor to be nonblocking. This contrived example exhibits the behavior of python that is preventing me from doing this: import os,...
4
by: Omid Fatemi | last post by:
I followed discussion in the group about this problem: ImportError: No module named fcntl I found out there are two modules: FCNTL fcntl the first one is obsolete and shouldn't be used. But...
0
by: Richard | last post by:
I am writing a script which accesses a DBM file using SDBM. The program works but throws out a warning of: - Argument "O_RDWR" isn't numeric in null operation I've included Fcntl but that...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.