Non blocking IO

Jp Calderone exarkun at intarweb.us
Mon Feb 17 18:14:24 CET 2003


On Mon, Feb 17, 2003 at 01:25:49PM +0000, Graeme Winter wrote:
> Graeme Winter wrote:
> > [snip]
> >
> >Traceback (most recent call last):
> >  File "test_blocking.py", line 43, in ?
> >    blocking_test(5)
> >  File "test_blocking.py", line 33, in blocking_test
> >    line = stdout.readline()
> >IOError: [Errno 11] Resource temporarily unavailable
> >
> >Which I guess means that readline() doesn't like non blocking fd's....

  Write your own wrapper around readline().  You can't expect more than a
single byte to be available when select() returns stdout as available for
reading.  Collect those bytes until you find a newline character, then
handle the line.

  Jp

-- 
C/C++/Java/Perl/Python/Smalltalk/PHP/ASP/XML/Linux (User+Admin)
Genetic Algorithms/Genetic Programming/Neural Networks
Networking/Multithreading/Legacy Code Maintenance/OpenGL
See my complete resume at http://intarweb.us:8080/
-- 
 up 8 days, 22:28, 4 users, load average: 0.09, 0.07, 0.04
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030217/956e17a6/attachment.pgp>


More information about the Python-list mailing list