2
我嘗試使用下面的代碼:子和額外的參數
args = 'LD_LIBRARY_PATH=/opt/java/jre/lib/i386/:/opt/java/jre/lib/amd64/ exec /opt/java/jre/bin/java -Xincgc -Xmx1G -jar craftbukkit-0.0.1-SNAPSHOT.jar'.split()
p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
不過,我收到的結果是:
Traceback (most recent call last):
File "launch.py", line 29, in <module>
p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__ errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1228, in _execute_child raise child_exception
OSError: [Errno 2] No such file or directory
沒有LD_LIBRARY_PATH的一部分,它工作正常。但是,我需要它。感謝您的幫助。
其實我嘗試,但我什麼也沒得到了以下的:p.stderr.readline() – dbdii407
@ dbdii407:我認爲這是一個獨立的問題。爲什麼不發佈一個單獨的問題? – NPE
爲什麼當原件尚未解決時又創建另一個問題? ;) – dbdii407