subprocess.Popen zombie

Robin Becker robin at reportlab.com
Wed May 20 09:16:44 EDT 2015


As part of a long running PyQT process running as a window app in Arch linux I 
needed an alert sound, I decided to use the beep command and the app code then 
looked like

pid = Popen(['/home/robin/bin/mybeep', '-r3', '-f750', '-l100', '-d75']).pid

the mybeep script handles module loading if required etc etc.

Anyhow, this works with one slight oddity. When this code is executed it works 
fine, but leaves behind a single zombie process, when next executed the zombie 
disappears and a new zombie replaces it.

Is this because I'm not waiting? Does the process module reap previous commands 
in some way? The code I used to use with os.spawnl was even worse in leaving 
zombies around. I suppose I needed to keep a record of all the pid's and wait on 
them at some convenient time. The subprocess version appears to be doing that 
for me somehow.


*NB* I did try PyQT's qApp.beep(), but it seemed to work only on windows.
-- 
Robin Becker




More information about the Python-list mailing list