Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

subprocess.Popen('start') fails

Running this in python will result in a WindowsError stating it cannot find the specified file

FAILS:

import subprocess

subprocess.Popen('start notepad.exe')

In a command window, it works

start notepad.exe

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.

Thanks

like image 567
Brett Avatar asked Jul 20 '26 21:07

Brett


1 Answers

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')

Also, any reason why not use just:

subprocess.Popen('notepad.exe')
like image 65
millimoose Avatar answered Jul 22 '26 12:07

millimoose



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!