The Python Oracle

Killing shell=True process results in ResourceWarning: subprocess is still running

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Island

--

Chapters
00:00 Killing Shell=True Process Results In Resourcewarning: Subprocess Is Still Running
00:46 Accepted Answer Score 9
01:05 Thank you

--

Full question
https://stackoverflow.com/questions/5247...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #subprocess

#avk47



ACCEPTED ANSWER

Score 11


You didn't wait for the process to end. Even if you kill the process, you're still supposed to wait for it so you don't have a zombie process hanging around. Python is warning you that you didn't wait.

Add a process.wait() call after killing it.