我有一个.sh脚本可供调用source the_script.sh。定期调用此方法很好。但是,我试图通过python脚本调用它subprocess.Popen。
从Popen调用它,在以下两个场景调用中出现以下错误:
foo = subprocess.Popen("source the_script.sh")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 672, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1213, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
>>> foo = subprocess.Popen("source the_script.sh", shell = True)
>>> /bin/sh: source: not found
是什么赋予了?当我可以在python之外访问时,为什么不能从Popen调用“源”?
人到中年有点甜
繁星coding
相关分类