subprocess.call(["/home/blah/trunk/blah/run.sh", "/tmp/ad_xml", "/tmp/video_xml"])
I'm doing it. However, inside my run.sh, I have "relative" paths. So, I have to "cd" into this directory, and then run the shell script. How to do it?
Use argument cwdtosubprocess.call()
cwd
subprocess.call()
From the docs here: http://docs.python.org/library/subprocess.html
cwd None, childs cwd . , , , cwd.
:
subprocess.call(["/home/blah/trunk/blah/run.sh", "/tmp/ad_xml", "/tmp/video_xml"], cwd='/tmp')
, subprocess.Popen Shell = True cwd = " "
EDIT: , , cwd:
subprocess.call(["/home/blah/trunk/blah/run.sh", "/tmp/ad_xml", "/tmp/video_xml"], cwd="PATH")
subprocess.call([ "/home/blah/trunk/blah/run.sh", "/tmp/ad_xml", "/tmp/video_xml" ], cwd = "/home/blah/trunk/blah" )
os.chdir(path)
http://docs.python.org/library/os.html#os.chdir