I am trying:
import subprocess
subprocess.call(["file.sh"])
But I keep getting:
Traceback (most recent call last):
File "project.py", line 85, in <module>
subprocess.call(["file.sh"])
File "/usr/local/lib/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/local/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/local/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
However when I try and run the script from the shell bash file.sh it works. So I'm confused as to why it doesn't work?
I am not committed to using subprocess so if there are other options please let me know.
file.sh(as opposed tobash file.sh) work from the command line? No? Why do you expectsubprocess.call(["file.sh"])to work then?(["bash file.sh"])and exactly the same result.