[Tutor] Python 2.2... os.exec catch stdout
Emile van Sebille
emile at fenx.com
Thu Jun 4 23:02:20 CEST 2009
On 6/4/2009 1:49 PM Chris Mueller said...
> /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?
What OS?
Emile
>
> Thanks,
> Chris
> /
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list