I am now using Python to run a command-line executable program that was developed by myself:
import subprocess
cmd = '../../run_demo'
print cmd
subprocess.Popen(cmd)
This script runs very well in windows. However, it runs on linux, the following errors are given:
Traceback:
File "script.py", line 6, in <module>
subprocess.Popen(cmd)
File "/user/lib/python2.5/subprocess.py", line 623, in _init_
erread, errwrite)
File "/user/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
As the executable command is printed in the script print cmd
, if I copy the content of cmd
, and then run in the command line, then the executable program can run. Any ideas? Thanks.