readline() blocks after select() says there's data??

Rich Cook wealthychef at mac.com
Fri Mar 15 11:51:44 EST 2002


At 11:09 PM -0600 3/14/02, Skip Montanaro wrote:
>     >>    selectables = [theProcess.childerr, theProcess.fromchild]
>     >>    (input, output, exc) = select.select([],selectables, selectables)
>     ...
>
>     >> It blocks forever waiting for theProcess.childerr.readline(bufsize)
>     >> to return.  I expect it to block waiting for select.select(); that
>     >> would not be a problem.  The problem is that select is claiming
>     >> there's stuff to be read, then when I try to read it, it's not there!
>     >> How can that be?
>
>Based upon the attribute names you are using, I suspect you instantiated
>os.Popen3 to create theProcess.  These are file objects, not sockets.  I
>believe select only blocks on sockets.  See the comments about asynchronous
>file i/o near the bottom of asyncore.py.

I don't really need select to block.  I just want it to be accurate. 
If it returns a file object in the list of things which are 
available, why should then readline() block on it?
-- 

-Sincerely, Rich Cook 925-784-3077
*******************************************************************
Sometimes it is said that man cannot be trusted with the government 
of himself. Can he, then, be trusted with the government of others?
         Thomas Jefferson
*******************************************************************




More information about the Python-list mailing list