How to terminate after traceback?

Thomas Wouters thomas at xs4all.net
Sun Sep 24 13:47:34 EDT 2000


On Sun, Sep 24, 2000 at 12:18:31PM -0600, Albert Wagner wrote:
> My book says that when python encounters an uncaught exception it
> terminates the program and prints a traceback.  I get a traceback
> without python terminating and have to kill it with my task manager.  Is
> there a more elegant, pythonish way?

You are probably talking about the Python interactive interpreter (the
prompt where you can type code.) It does indeed not terminate when an
exception is raised. If you want to quit it, you'll have to either call
sys.exit(), or type the EOF (end of file) character. This is ^D on Unix, and
^Z on Windows. Unsure about other OSes, sorry. I believe that you can also
'properly' exit the interpreter by clicking on the window-close button,
under Windows & most other windowed operating systems.

If you're talking about an actual script not exiting when an exception is
raised, you'll have to provide more info. It could be that your script forks
or uses threads, and only one of those processes/threads raises the
exception. 

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list