On Fri, Mar 8, 2013 at 1:37 PM, 3n2 Solutions <[email protected]> wrote:
> subprocess.check_call(['c:/FinalTest/fix.exe', '-com 17','-baud
> 38400', '-setconfig base.dat'])
You can use a single string for the command on Windows. subprocess
will create one anyway, but let's stick with a list, split on the
spaces in the string.
Since the command works in the shell from the exe directory, try
setting the current working directory (cwd) to C:\FinalTest:
import sys
import os
import subprocess
exepath = 'c:\\FinalTest'
exefile = 'fix.exe'
cfgfile = 'base.dat'
exe = os.path.join(exepath, exefile)
cmd = [exe, '-com', '17', '-baud', '38400', '-setconfig',
cfgfile]
try:
subprocess.check_call(cmd, cwd=exepath)
except subprocess.CalledProcessError as e:
# exit, logging, etc
sys.exit(str(e))
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor