[Baypiggies] How to tell if sys.excepthook has already been overridden?
Keith Dart
keith at dartworks.biz
Tue Mar 24 11:22:44 CET 2009
Paul McNett wrote:
> Hi,
>
> Is there a general way to tell if sys.excepthook has been overridden
> already or not? I want to override it in my library, but only if it
> hasn't already been overridden by some other library or
> end-application code.
The original (built-in) exception hook is available as
"sys.__excepthook__. So you can test:
if sys.excepthook is sys.__excepthook__:
print "original hook"
else:
print "except hook overridden"
More information about the Baypiggies
mailing list