how to use execfile with argument under windows

Peter Otten __peter__ at web.de
Tue Jan 2 12:49:06 EST 2007


baur79 wrote:

> i need to execute this command line (different source for n times)
> 
> filename.exe -type png -source sourcearg -file filename.png

> i try with python (python script and filename.exe in same directory)

> execfile("filename.exe -type png -source sourcearg -file filename.png")

That does not do what you think it does, see

http://docs.python.org/lib/built-in-funcs.html#l2h-26

You need os.system() or, for more complex applications, the subprocess
module.

Peter



More information about the Python-list mailing list