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


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

Linux Kernel 2.4.7-10
python 2.1.1
[rgrow@linux01 python]$ /usr/bin/python2.1
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

DeprecationWarning: the FCNTL module is deprecated;
please use fcntl
Traceback (most recent call last):
File "./testfcntl.py", line 6, in ?
fcntl.fcntl(fd, FCNTL.F_SETFL, fl |
AttributeError: 'module' object has no attribute
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?



Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

Jul 18 '05 #1
  • viewed: 1329

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.