correct way of running a sub-process

Daniel Danger Bentley dbentley at
Thu Feb 12 17:54:24 CET 2004

Correct me if I'm wrong, but can't this not catch all the output?  Or is
read in python guaranteed to return all the data that can ever be returned
(unlike the C library function)?

"Thomas Guettler" <guettli at> wrote in message
news:pan.2004. at
> def shell_command(cmd):
>     # There mustnot be output to stdout or stderr
>     # otherwise an exception is raised
>     p=popen2.Popen4(cmd) # read stdout and stderr
>     ret=p.wait()
>     if ret or output:
>         raise("Error in shell_command '%s': ret=%s output='%s'" %(
>             cmd, ret, output))

More information about the Python-list mailing list