read stdout/stderr without blocking

Adriaan Renting renting at
Mon Sep 12 16:09:30 CEST 2005

The line only means it will read a maximum of 1024 characters, most of the output I try to catch is much shorter. I think that if the output is longer as 1024, it will read the rest after another call to, but I think I have not yet come across that case and have not tested it.

I set the error pipe to OS_NONBLOCKing earlier in the code, but I can't remember if that has anything to do with the 

Note: I'm using Python 2.3.4/2.3.5, not tested on 2.4.x yet.
>>>Jacek Pop*awski <jpopl at> 09/12/05 2:39 pm >>> 
>        ready =, [], [], 0.25) ##continues after 0.25s 
>        for file in ready[0]: 
>            try: 
>                text =, 1024) 
How do you know here, that you should read 1024 characters? 
What will happen when output is shorter? 

More information about the Python-list mailing list