fdopen() question

Carsten Gaebler news at snakefarm.org
Tue Apr 8 17:53:28 CEST 2003


I'm doing some socket programming and use poll() to check if there is
data to read. poll() returns a list of (fd, event)-tuples where fd is
(as I understand) a file descriptor. Since the input consists of lines
I call os.fdopen(fd, 'r') to have a file object with a readline() method.
Unfortunately fdopen() fails with:

Traceback (most recent call last):
  File "./listener.py", line 27, in ?
    f = os.fdopen(fd, 'r')
OSError: [Errno 9] Bad file descriptor

What am I missing?


More information about the Python-list mailing list