我在调用 shell 脚本时遇到了以下错误,如何使用 check_call 或通过任何其他 python 函数调用 shellscript?
import os from subprocess import check_call,Popen, PIPE
def main ():
BUILD_ROOT="//local/mnt/workspace//AU"
os.chdir(BUILD_ROOT)
print os.getcwd()
check_call(['./test.sh'])
if __name__ == '__main__':
main()
错误:-
File "test.py", line 11, in <module>
main()
File "test.py", line 8, in main
check_call(['./test.sh'])
File "/usr/lib/python2.6/subprocess.py", line 493, in check_call
retcode = call(*popenargs, **kwargs)
File "/usr/lib/python2.6/subprocess.py", line 480, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error