[Tutor] Python 2.2... os.exec catch stdout
Chris Mueller
worminater at gmail.com
Thu Jun 4 22:49:02 CEST 2009
*Hello.
I am relegated to running python 2.2; so I do not have access to subprocess.
In my script; at one point, I need to run a program; interact with the
program; exit the program; and parse the output printed to stdout.
This would be simple; if I did not need to interact with my sub-program. I
currently have..
import os
program = "vim"
arguments = ["myFile"]
pid = os.fork()
if not pid:
os.execvp(program, (program,) + tuple(arguments))
os.wait()[0]
This works fine; lets me interact with "vim" fine; and return to the python
script when I am done; but I do not seem to be able to execute read stdout;
and all examples I have found on the net do not allow me to interact with
the called program.
Any pokes int he right direction?
Thanks,
Chris
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090604/c4a88074/attachment.htm>
More information about the Tutor
mailing list