I have a problem with a script I wrote.
I'm just trying to run an executable (I took arduino.exe
as an example). However, I either get a FileNotFoundError: [WinError 2]
or a non-zero exit status
(depending on Shell=True
is off
or on
, respectively).
The code of my entire script is simple:
import subprocess
subprocess.run("C:\Program Files (x86)\Arduino\arduino.exe",shell=True,check=True)
I am aware that Shell=True poses a security risk, but have found no other way to solve the path not found error. My other guess is that the code struggles with the numbers and spaces in the path?
Any help is greatly appreciated.