global exception catching

Gerrit Holl gerrit at nl.linux.org
Thu Feb 27 08:51:32 EST 2003


Hilbert schreef op donderdag 27 februari om 14:43:49 +0000:
> Hello,
> 
> Is there a way to catch a "global" exception in a python
> program (meaning that if there would be an error
> during execution it could call a function before exiting)?
> 
> I have a program that creates large temp files and in case
> of any unforseen problems I still need to clean up before
> exiting.

Are you looking for sys.excepthook?
http://www.python.org/dev/doc/devel/lib/module-sys.html#l2h-262

yours,
Gerrit.

-- 
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
	http://www.sp.nl/





More information about the Python-list mailing list