2013-01-02 2 views
1

셸 스크립트를 호출하는 중에 다음 오류가 발생합니다. check_call 또는 anyother 파이썬 함수를 사용하여 셸 스크립트를 호출하려면 어떻게해야합니까? 서브 프로세스 수입 check_call,는 popen에서
수입 OS , PIPEcheck_call을 사용하여 쉘 스크립트 호출하기

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 

답변

1

= TRUE는

check_call(['./test.sh'],shell=True) 
그것을 고정
관련 문제