Reputation: 1260
I confused as to why the following code returns an error:
import subprocess
a = subprocess.Popen(["docker-compose down weather-data"])
a.wait()
I get as an error:
FileNotFoundError: [Errno 2] No such file or directory: 'docker-compose down weather-data'
Upvotes: 0
Views: 462
Reputation: 136
Your command needs to be in an array with each part of the command as one element in the array. For example:
import subprocess
a = subprocess.Popen(["docker-compose", "down", "weather-data"])
a.wait()
If it's all in one string, Python is trying to find a single executable named "docker-compose down weather-data".
Upvotes: 2