readline() blocks after select() says there's data??
Grant Edwards
grante at visi.com
Sat Mar 16 00:41:48 EST 2002
In article <2b57f654.0203151021.7f709e4c at posting.google.com>, wealthychef wrote:
> "Donn Cave" <donn at drizzle.com> wrote in message news:<1016173476.645562 at yasure>...
>> Quoth grante at visi.com (Grant Edwards):
>> ...
>> | When select returns a file descriptor, that means that read()
>> | won't block. If only a partial line is available, then
>> | readline() will still block. I doubt that this is going to be
>> | an issue, since your output is probably line-oriented.
> If it is not line-oriented, must I then use select.select combined
> with read(1) and go character by character?
No, you can read all the available data with a single call to
read. The value you pass to read is just a maximum, and read
will return as much data as it can.
I think this would be an excellent use for a generator. But if
you've never done any co-routine stuff before it can be a bit
disorienting.
> That reminds me, is there a way to get the integer value of a
> character in Python analogous to casting a char to an int in C?
c = "A"
i = ord(c)
--
Grant Edwards grante Yow! Did YOU find a
at DIGITAL WATCH in YOUR box
visi.com of VELVEETA?
More information about the Python-list
mailing list