python spawn new process, rout stdin/out

K

kmkz89

Hi,

I'm trying to make a program that acts as an intermediate between the
user and another executable. When my python program is executed, I
would like another .exe to be spawned within the python program, and
the stdin/stdout to be routed from the user to the program. So if my
program is booted into a console window, anything typed by the user
will be passed to the subprocess and any output from that executable
will appear in the console, showing the user what happened. In
addition, when the python program is closed, the subprocess should be
closed.

Any ideas how to do this? I am far from a Python newbie but I know
little to nothing about os.*/subprocess.* so I need quite a bit of
assistance.

Thanks guys!
kmkz
 
K

kmkz

How exactly do I map the main program's STDOUT (what the user sees) to
the subprocess' STDOUT? In effect I want it to appear as though they
just executed the program itself.
 
K

kmkz

ok solved that by using the call() method

I now have a bigger problem: the executable always wants to open in its
own window. how do I stop this?
 
S

Steve Holden

kmkz said:
ok solved that by using the call() method

I now have a bigger problem: the executable always wants to open in its
own window. how do I stop this?
Call pythonw instead of python.

regards
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top