passthru()를 사용하여 파이썬 스크립트를 호출 할 때 오류가 발생했습니다. 하위 프로세스 및 파이프)를 PHP로 대체합니다.passthru() + 서브 프로세스의 파이프 = 트레이스 백 (가장 최근 호출 마지막) : stdout = subprocess.PIPE의 (...)
Traceback (most recent call last): File "…/Desktop/h.py", line 11, in stdout=subprocess.PIPE) #set up the convert command and direct the output to a pipe File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py", line 593, in init errread, errwrite) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py", line 1079, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory
PHP의의 경유 :
<?php
passthru("/usr/bin/python2.5 /Users/Nagar/Desktop/h.py $argument1 $argument2 1 2>&1");
?>
오류의 원인이
내 파이썬 라인 :
p1 = subprocess.Popen(['convert', fileIn, 'pnm:-'], stdout=subprocess.PIPE) #set up the convert command and direct the output to a pipe
사용하는 방법을 표준 출력 = subprocess.PIPE 여기
오류입니다 제대로 하위 프로세스에 있습니까?답장을 보내주십시오.