我有一個錯誤,當我使用passthru()調用python腳本子進程和管道)與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");
?>
我的Python線,導致該錯誤:
p1 = subprocess.Popen(['convert', fileIn, 'pnm:-'], stdout=subprocess.PIPE) #set up the convert command and direct the output to a pipe
如何使用標準輸出= subprocess.PIPE在子流程中正確嗎?
期待您的回答。