Calling Exe from Python

M

muhamad.abbas

Hello Folks,

This is what i am required to do.
Call an executable from my python script, and when the executable is
finished running, i should continue with my python script.

I have tried "os.exec()" but it calls the executable and never returns
to the calling python script.
I tried "os.fork" it will start an independent process,
since logic of my program depends on the results of executable.

I am unable to figure, how to do it.
Hope you folks would help me.

~JinBaba
 
R

Rex Turnbull

muhamad.abbas :
Hello Folks,

This is what i am required to do.
Call an executable from my python script, and when the executable is
finished running, i should continue with my python script.

I have tried "os.exec()" but it calls the executable and never returns
to the calling python script.
I tried "os.fork" it will start an independent process,
since logic of my program depends on the results of executable.

I am unable to figure, how to do it.
Hope you folks would help me.

~JinBaba
I use
import os
os.spawnl(os.P_WAIT, pathToExe, pathToExe, parm1, parm2, parm3, )

Remember that pathToExe must also be the first parameter.
There are many other flavors of os.spawn, check documentation!

Good luck,
Rex
 

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

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top