Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Defunct when using subprocess.Popen

Reply
Thread Tools

Re: Defunct when using subprocess.Popen

 
 
Gabriel Genellina
Guest
Posts: n/a
 
      07-30-2008
En Tue, 29 Jul 2008 10:04:46 -0300, Gordon Maria
<(E-Mail Removed)> 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

 
Reply With Quote
 
 
 
 
Bruce Frederiksen
Guest
Posts: n/a
 
      07-30-2008
On Wed, 30 Jul 2008 01:56:28 -0300, Gabriel Genellina wrote:

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


The subprocess.Popen object supports a 'wait' method directly.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
still get a <defunct> using a python script in the crontab martijn@gamecreators.nl Python 2 09-19-2007 03:02 PM
Defunct Processes With subprocess.Popen John Abel Python 2 05-12-2005 07:53 AM
Removing defunct Tunnel to Current Config Pedro Sosa Cisco 0 08-09-2004 01:58 PM
Defunct Epson Photo 780? FRank Benedict Digital Photography 1 02-01-2004 03:13 PM
<defunct> processes Gordon Beaton Java 4 11-07-2003 06:18 PM



Advertisments