472,368 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

fcntl O_NDELAY constant not found in python 2.3 on linux

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, fcntl, FCNTL

file = open("/tmp/testfd.txt", 'w')
fd = file.fileno()
fl = fcntl.fcntl(fd, FCNTL.F_GETFL)
fcntl.fcntl(fd, FCNTL.F_SETFL, fl | FCNTL.O_NDELAY)
print "Made it!"
When I run this in the following environment, it works
fine:

Linux Kernel 2.4.7-10
python 2.1.1
[rgrow@linux01 python]$ /usr/bin/python2.1
../testfcntl.py
Made it!

However, when I run this with either python 2.3.2 or
2.3.3, I get the following output:

[rgrow@linux01 python]$ python ./testfcntl.py

/usr/local/lib/python2.3/FCNTL.py:7:
DeprecationWarning: the FCNTL module is deprecated;
please use fcntl
DeprecationWarning)
Traceback (most recent call last):
File "./testfcntl.py", line 6, in ?
fcntl.fcntl(fd, FCNTL.F_SETFL, fl |
FCNTL.O_NDELAY)
AttributeError: 'module' object has no attribute
'O_NDELAY'
What is the correct way that I should be making this
kind of a call in 2.3 to both avoid the deprecation
warning as well as the attribute error?

Thanks,

Ryan


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

Jul 18 '05 #1
0 1478

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:...
11
by: Chris Green | last post by:
Hey folks, Is there anyway for a signal handler in python to get the information from a 3 argument signal handler rather than just the signal number and stack frame? I've got an application...
3
by: Rob McCrea | last post by:
Hi all, On windows98SE, running Python 2.3.4 (#53, May 25 2004, 21:17:02) on win32, the built-in help() function gives me a deprecation warning when used on my docstrings. just help() start...
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: wicur | last post by:
this statement was OK in old version of perl: (my $constname = $AUTOLOAD) =~ s/.*:://; in v5.8.1 built for i386-linux-thread-multi returned ...
3
by: thakadu | last post by:
The following code works as expected when run in the main body of a python script (ver 2.3.5) on OpenBSD v3.8. but when it is in the body of a function definition it does not work. It does not...
5
by: marcello | last post by:
Hello I need to do this: 1 opening a file for writing/appending 2 to lock the file as for writing (i mean: the program that lock can keep writing, all others programs can't ) 3 wtite and...
9
by: mhearne808[insert-at-sign-here]gmail[insert-dot-he | last post by:
I'm having a number of problems with the fcntl module. First off, my system info: Mac OS X Darwin igskcicglthearn.cr.usgs.gov 8.10.1 Darwin Kernel Version 8.10.1: Wed May 23 16:33:00 PDT 2007;...
2
by: xucs007 | last post by:
I ran following 2 programs (lock1, lock2) at almost same time, to write either "123456", or "222" to file "aaa" at the same time. But I often just got "222456" in "aaa" . Is this a bug of python...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

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.