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

Skip Montanaro skip at pobox.com
Fri Mar 15 00:09:05 EST 2002


    >>    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.

-- 
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)




More information about the Python-list mailing list