how to kill a subprocess

cerr ron.eggler at gmail.com
Fri Sep 10 14:56:15 EDT 2010


On Sep 10, 11:45 am, Christian Heimes <li... at cheimes.de> wrote:
> Am 10.09.2010 19:51, schrieb cerr:
>
> > Thanks for your suggestion, changed my code now to:
>
> >   process=subprocess.Popen(commandlist)
> >   ...
> >   ...
> >   process.kill()
> >   os.waitpid(process.pid, 0)
> > but it's not killing the process running. it still runs in the
> > background and i don't see any errors, we're running python 2.6.4
> > any more clues?
>
> It's not an issue with your Python process but with its parent process.
> The parent process has to call the OS's waitpid() function with the PID
> of the Python process in order to reap it. Please show us how you are
> starting and controlling the Python process in your PHP code.

But I wanna kill the child process I start from my python code.
It's like
PHP -> Python -> Perl

and when the connection PHP -> Python seems to work well!





More information about the Python-list mailing list