fdopen() question

sik0fewl xxdigitalhellxx at hotmail.com
Tue Apr 8 13:23:48 EDT 2003


Carsten Gaebler wrote:
> Carsten Gaebler wrote:
> 
>>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?
>>
> 
> 
> Seems I have to open the file in 'w+' mode to make it work.
> 
> cg.

Make sure the first fdopen() parameter is a valid file descriptor, like 
the ones returned by fileobj.fileno(). The exception that was raised is 
raised if the file descriptor you are trying to open has been closed or 
never existed in the first place.

-- 
Hope this helps,
Ryan





More information about the Python-list mailing list