How to kill Python interpreter from the command line?
notbob
notbob at nothome.com
Thu May 8 13:30:34 EDT 2008
On 2008-05-08, spectrumdt at gmail.com <spectrumdt at gmail.com> wrote:
> I am running Fedora Linux and KDE, using the Konsole command line.
I also run python from Konsole.
> 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?
Are you refering to the python editor? If so, try cntrl-d.
> 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).
If you want to completely kill python, open another Konsole session and kill
it from there. There are several ways. The simplist is:
killall python
....which will kill python without killing the Konsole session.
This will find the python pid number and kill it with -15 which cleans
everything up nicely before killing. If that doesn't work, you may need to
use kill -9, which is kill with extreme prejudice and leaves all the bodies
lying around to crap up the works. To do that, try:
ps aux | grep python
.....which will give you the pid number and then you plug it into:
kill -9 pid_number
If all that doesn't work, change to Slackware! ;)
nb
More information about the Python-list
mailing list