0

I'm using python 3.6 on Win 10. I'm trying to run this:

subprocess.run(["docker run -ti -p 3000:3000 opendronemap/nodeodm"])

but get this error:

Traceback (most recent call last):
 File "C:/AgroScout/Projects/ortho/mdreader.py", line 67, in <module>
 RunODM()
File "C:/AgroScout/Projects/ortho/mdreader.py", line 38, in RunODM
subprocess.run(["docker run -ti -p 3000:3000 opendronemap/nodeodm"])
File "C:\Users\ehud\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 489, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\ehud\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\ehud\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

Process finished with exit code 1

When running the command from the CMD all works fine. What is missing? Thanks

Ehud Grand
  • 3,501
  • 4
  • 33
  • 52
  • `FileNotFoundError: [WinError 2] The system cannot find the file specified` ... you probably need to do something so the file can be found. Check your paths when working in python - maybe your CMD has other environment set so docker is found. Try a full path for docker.exe. – Patrick Artner Feb 07 '21 at 09:54
  • `print(os.environ['path'])` to see why docker can't be found – Peter Wood Feb 07 '21 at 09:58
  • 1
    Passing a list containing a single string with spaces is the fundamental error here. Either take out the `[...]` brackets and add `shell=True` (not strictly necessary on Windows, but good form), or rearticulate the command into a list of strings like `['docker', 'run', ...]` – tripleee Feb 07 '21 at 10:01

0 Answers0