Getting a process's output

Gerrit Holl gerrit at nl.linux.org
Mon Jan 19 17:13:50 EST 2004


Dietrich Epp wrote:
> Is there any easy way to get all the output of a process?  Ideally, the 
> function takes parameters like exec(), calls fork(), wait()s for the 
> process to complete, and returns the process's stdout, stderr, and exit 
> status.  By stdout and stderr I don't mean file objects or 
> descriptors... I mean strings containing the entire output.
> 
> I would try to do it myself, but I'm not sure how to interleave the 
> operations.

Try commands.getstatusoutput() or the various popen functions.

yours,
Gerrit.

-- 
272. If any one hire a cart alone, he shall pay forty ka of corn per
day.
          -- 1780 BC, Hammurabi, Code of Law
-- 
PrePEP: Builtin path type
    http://people.nl.linux.org/~gerrit/creaties/path/pep-xxxx.html
Asperger's Syndrome - a personal approach:
	http://people.nl.linux.org/~gerrit/english/




More information about the Python-list mailing list