Correctly reading stdout/stderr from subprocess

Christoph Haas email at christoph-haas.de
Thu Jun 15 04:59:26 EDT 2006


On Thu, Jun 15, 2006 at 10:37:18AM +0200, Maric Michaud wrote:
> Le Mercredi 14 Juin 2006 19:56, Christoph Haas a écrit :
> >
> > Quite interesting. I dived into /usr/lib/python2.4/subprocess.py and
> > found out that the "communicate()" method actually works similarly. I
> > might even prefer your version 
> 
> You should'nt IMO, the former 'run2' was quite short compared to this one. 
> Also Popen.communicate is maintained by experienced folks, your function 
> (mine in this case :) ) is not. This is just more job.

Indeed. Still it's interesting to see that your solution was similar.

> > because I get the returncode from 
> > run.wait() what "communicate()" does not.
> >
> 
> What the problem with getting it from an attribute (returncode) ?

communicate() does not return it.

Kindly
 Christoph



More information about the Python-list mailing list