2014-10-12 18 views
3

我已經在運行的Python 2.7.3(窗口),一個代碼,我嘗試在Python的2.7.8(窗口)運行它,並收到以下錯誤:python異常錯誤子進程文件丟失 - 但是什麼文件?

主:INFO **啓動主**

Traceback (most recent call last): 
    File "C:\wamp\www\prenderer\src\main.py", line 82, in <module> 
    nuke_process = launch_nuke() 
    File "C:\wamp\www\prenderer\src\main.py", line 31, in launch_nuke 
    query = subprocess.Popen(r"query process", stdout=subprocess.PIPE) 
    File "F:\python27\lib\subprocess.py", line 710, in __init__ 
    errread, errwrite) 
    File "F:\python27\lib\subprocess.py", line 958, in _execute_child 
    startupinfo) 
WindowsError: [Error 2] The system cannot find the file specified 
>>> 

有什麼不對?

回答

3

通行證shell=True論點:

query = subprocess.Popen(r"query process", stdout=subprocess.PIPE, shell=True) 

或通過命令行參數作爲列表:

query = subprocess.Popen(["query", "process"], stdout=subprocess.PIPE) 

query process否則被識別爲節目代替query