traceback.print_exc() supposed to stop exception propagation.

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sun Apr 6 16:28:08 EDT 2008


En Sun, 06 Apr 2008 16:16:46 -0300, Sami <sami.islam at NOSPAMbtinternet.com>  
escribió:

> In the Python book that I am using to learn the language it says that
> the traceback.print_exc() can be used to stop exception propagation and
> make the program keep running.

Either the book is wrong or you have misinterpreted what you read.
 From http://docs.python.org/lib/module-sys.html:

excepthook(type, value, traceback)

This function prints out a given traceback and exception to sys.stderr.

When an exception is raised and uncaught, the interpreter calls  
sys.excepthook with three arguments, the exception class, exception  
instance, and a traceback object. In an interactive session this happens  
just before control is returned to the prompt; in a Python program this  
happens just before the program exits. The handling of such top-level  
exceptions can be customized by assigning another three-argument function  
to sys.excepthook.

-- 
Gabriel Genellina




More information about the Python-list mailing list