readline() blocks after select() says there's data??
Richard Cook
wealthychef at mac.com
Fri Mar 15 13:24:17 EST 2002
Thanks, good point. the actual problem was I was reversing the first
two args to select.select(). D'oh!
At 6:03 PM +0100 3/15/02, Sjoerd Mullender wrote:
>When select tells you there is something available to read, it doesn't mean
>there is a whole line available to read! It is very well possible that there
>is only one character available, but readline may want to read (a lot) more
>than that.
>
>Rich Cook wrote:
>>
>> 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
>> *******************************************************************
> >
> > --
> > http://mail.python.org/mailman/listinfo/python-list
--
More information about the Python-list
mailing list