[Tutor] question re: executing exe files with arguments

Martin Walsh mwalsh at groktech.org
Mon May 21 00:06:39 CEST 2007

Hey Janani,

Janani Krishnaswamy wrote:
> Hi!
> I am having trouble executing an exe file with 3 arguments within a
> python script.  Right now I have something like this:
> os.system(r'"1/2/3/program 1/2/3/argument1 1/2/3/argument2"')

Without an error message, or traceback, this is difficult to diagnose.
But, my guess is your use of quotes is causing the issue. Can you
successfully run the hypothetical command as used above (with the same
double-quote placement) in a shell? as in:

user at host:~$ "1/2/3/program 1/2/3/argument1 1/2/3/argument2"
... or, if you are a windows user ...
c:\> "1/2/3/program 1/2/3/argument1 1/2/3/argument2"

I think the command string would be treated as one long path, in this
case. If your paths contain whitespace or other special characters, you
probably want something like this:

"1/2/3/program" "1/2/3/argument1" "1/2/3/argument2"


More information about the Tutor mailing list