How to kill Python interpreter from the command line?

Diez B. Roggisch deets at nospam.web.de
Thu May 8 11:50:28 EDT 2008


spectrumdt at gmail.com wrote:

> Hello.
> 
> I am running Fedora Linux and KDE, using the Konsole command line.
> 
> When coding Python, I regularly make a bug causing my program to not
> terminate. But how do I kill the non-terminating Python interpreter
> without killing the entire Konsole?
> 
> The default way of killing the current process on the command line is
> Ctrl+C, but that doesn't work with Python. Neither do the "terminate
> task", "suspend task" or "interrupt task" commands (available from
> right-click in Konsole).
> 
> So, can someone please help? How do I kill Python without having to
> restart Konsole?


put it into the background using C-z, and then look for it's pid using ps.
Issue a kill -9 towards it.

For example, I just in the moment use this commandline to do so (for a
certain script named frontend_cherrypy.py:

ps ux | grep frontend | kill -9 `cut -c 5-15`

Diez



More information about the Python-list mailing list