Reputation: 2256
I'm getting this error when trying to run a Python script. Is it saying that it can't find subprocess.py? Because I found it in the location it's listing there, so I doubt that's the issue. What file can't it find?
Traceback (most recent call last):
File "D:\Projects\PythonMathPlots\MandelbrotVideoGenerator.py", line 201, in <module>
run( ['open', 'MandelbrotZoom.mp4'] )
File "C:\Users\Aaron\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 472, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\Aaron\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "C:\Users\Aaron\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
Upvotes: 2
Views: 1473
Reputation: 7353
You may also try with subprocess.Popen(args, shell=True)
. The use of shell=True
may be useful.
Also, use a path defined as path = os.path.join(filepath, filename)
and then before passing the path
to Popen
, assert if os.path.exists(path)==True
.
But note that there are some downsides to using shell=True
:
Upvotes: 0
Reputation: 1750
Make sure the user you're running the script as has read permission for the file.
Upvotes: 0
Reputation: 23498
You may need to put the full path in the run(...)
command, to the open
file, and the path to the .mp4 file as well.
Most likely, open
does not exist on your system and you have to use the name of the video player software instead.
Upvotes: 1