How to kill Python interpreter from the command line?

Marco Mariani marco at sferacarta.com
Thu May 8 11:51:17 EDT 2008


spectrumdt at gmail.com wrote:

> The default way of killing the current process on the command line is
> Ctrl+C, but that doesn't work with Python.

It should work.

Do you have a bare except: which intercepts SystemExit as well?

If so, be as specific as possible in what you intercept, or at least 
catch StandardError:

In [1]: StandardError ?
Type:           type
Base Class:     <type 'type'>
String Form:    <type 'exceptions.StandardError'>
Namespace:      Python builtin
Docstring:
     Base class for all standard Python exceptions that do not represent
     interpreter exiting.



More information about the Python-list mailing list