Reraising exceptions "intact"
Oleg Broytmann
phd at phd.fep.ru
Fri Jun 8 12:10:53 EDT 2001
On Fri, 8 Jun 2001, Jesus Cea Avion wrote:
> try :
> func()
> except exceptions.KeyboardInterrupt :
> raise exceptions.KeyboardInterrupt
> except :
> pass
>
> Here we keep "func" running except if the user press CONTROL+C. But in
> this case I'd like to see a traceback for the original interrupt point,
> not the "artificial" "raise".
try :
func()
except exceptions.KeyboardInterrupt :
import traceback; traceback.print_exc()
except :
pass
Oleg.
----
Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-list
mailing list