Why is PyCharm killing my subprocess.Popen?
I have a very basic
subprocess.Popen command like:
cmd = ['docker', 'run', '--name=test','server'] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
When I run this in a Python script from terminal, this correctly launches the docker image and the image is persisted until I
docker stop it.
However, when I run the same code from PyCharm 5, the docker image is immediately stopped when the above line is completed.
I have verified this in the debugger (running
docker ps -a shows this image immediately dies when launched from PyCharm).
What do I have to do in order to keep my subprocess opened when running with PyCharm? Not being able to run the debugger is quite annoying.
One Solution collect form web for “Why is PyCharm killing my subprocess.Popen?”
Are you printing out the output from the Popen call (stdout and stderr)? What does it say?
Launching subprocesses from an IDE can be tricky, because certain environment variables (like
PATH) may not be set in the same way as your shell.