[英]python exception error subprocess file missing - but what file?
我有一个在python 2.7.3(windows)上运行的代码,我尝试在python 2.7.8(windows)上运行它并得到以下错误:
主要: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
>>>
怎么了?
传递shell=True
参数:
query = subprocess.Popen(r"query process", stdout=subprocess.PIPE, shell=True)
或者将命令行参数作为列表传递:
query = subprocess.Popen(["query", "process"], stdout=subprocess.PIPE)
否则, query process
被识别为程序而不是query
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.