subprocess.Popen('start') 失败 [英] subprocess.Popen('start') fails
本文介绍了subprocess.Popen('start') 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 python 中运行它会导致一个 WindowsError,指出它找不到指定的文件
Running this in python will result in a WindowsError stating it cannot find the specified file
失败:
import subprocess
subprocess.Popen('start notepad.exe')
在命令窗口中,它可以工作
In a command window, it works
start notepad.exe
我猜它是 Windows 无法找到 start[.exe?] 的路径问题,它位于何处,以便我可以将其添加到路径中或仅将其包含在 Popen 调用中.
Im guessing its a path thing where windows can't locate start[.exe?] Where is this located so i can add it in the path or just include it in the Popen call.
谢谢
推荐答案
我不完全确定 start
是一个程序.我认为这可能是 CMD shell 的内置命令.试试
I'm not entirely sure start
is a program. I think it might be a built-in command of the CMD shell. Try
subprocess.Popen('cmd /c start notepad.exe')
此外,任何不使用 just 的原因:
Also, any reason why not use just:
subprocess.Popen('notepad.exe')
这篇关于subprocess.Popen('start') 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文