Popen confusion.

Chris Liechti cliechti at gmx.net
Wed May 22 17:44:39 EDT 2002


olczyk at interaccess.com (Thaddeus L. Olczyk) wrote in 
news:3cec0da5.14728828 at nntp.interaccess.com:

> I need to spawn a process in such a way that I have access to three
> pipes ( the usual suspects ) and am able to retrieve the return
> status.
> The python documentation is very confusing about this.
> Can anyone help?
> 

http://python.org/doc/current/lib/os-newstreams.html says:
"""
popen3(cmd[, mode[, bufsize]])
Executes cmd as a sub-process. Returns the file objects (child_stdin, 
child_stdout, child_stderr).
"""

i think the return value of child_stdout.close() is the exit code.

however you can also use the popen2 module which has additional 
functionality:
http://python.org/doc/current/lib/module-popen2.html and
http://python.org/doc/current/lib/popen3-objects.html

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list