call an exturnal program in python

Steve Holden steve at holdenweb.com
Fri Nov 21 07:57:50 EST 2008


Adam wrote:
> I am trying to run an external program in my code using
> os.system('exename -exearg') but the exe has an "&" in it so windows
> thinks it's two commands any way around this?
> 
Have you tries quoting the exename:

  os.system('"exename" -exearg')

That might help. How do you run it from the command line?

You might be better using subprocess.call(), since that allows you to
run subprocesses without the shell interpreting the command line.

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list