1
我在調用shell腳本時遇到以下錯誤,如何使用check_call或通過其他python函數調用shellscript?
進口OS 從子進口check_call,POPEN,PIPE使用check_call調用shell腳本
def main():
BUILD_ROOT="//local/mnt/workspace//AU"
os.chdir(BUILD_ROOT)
print os.getcwd()
check_call(['./test.sh'])
if __name__ == '__main__':
main()
ERROR: -
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