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

Skip Montanaro skip at pobox.com
Fri Mar 15 11:57:58 EST 2002


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

Remember that select() is lower level than readline().  As someone else
pointed out, select() may return because there is data available, but it
makes no promises about what that data is.  Calling readline() may then hang
waiting for other conditions (presence of a newline in the input, for
example).

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




More information about the Python-list mailing list