467,145 Members | 1,056 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,145 developers. It's quick & easy.

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
  • viewed: 1329
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Chris Green | last post: by
3 posts views Thread by Rob McCrea | last post: by
4 posts views Thread by Omid Fatemi | last post: by
reply views Thread by wicur | last post: by
5 posts views Thread by marcello | last post: by
9 posts views Thread by mhearne808[insert-at-sign-here]gmail[insert-dot-he | last post: by
2 posts views Thread by xucs007@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.