Defunct when using subprocess.Popen

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Jul 30 00:56:28 EDT 2008


En Tue, 29 Jul 2008 10:04:46 -0300, Gordon Maria  
<Maria.Gordon at afconsult.com> escribi�:

> I'm running a GUI in python which is able to launch a separate python  
> process
> that will run forever. In rare cases I will want to kill the launched  
> process.
> Every time I do so, I end up with the process as defunct. Can anybody  
> help me
> clean it up in a nice way?
>
> On request from GUI I do the following:
> os.kill(process.pid,9)
>
> FYI, it is all running on Linux.

You should call os.waitpid() after killing the child process, to let the  
OS free the resources allocated to it.

-- 
Gabriel Genellina




More information about the Python-list mailing list