[python-win32] traceback.print_exception(type, val, tb) not working under 2.5.2
Sami Islam
sami_islam at hotmail.com
Sat Apr 5 23:27:43 CEST 2008
Hello,
I am new to Python.
This is my code:
-------------------------------------------
import sys
import traceback
def MyExHook(typ, val, tb):
print "Inside MyExHook"
tb.print_exception(typ, val, tb)
T, V, B = sys.exc_info()
sys.excepthook = MyExHook(T, V, B)
x = 1/0
-------------------------------------------
and this is what I get
------------------------------------------
Inside MyExHook
Traceback (most recent call last):
File
"E:/Home/Programming/Python/TryProjects/ExceptHandling1/Except4.py",
line 11, in
sys.excepthook = MyExHook(T, V, B)
File
"E:/Home/Programming/Python/TryProjects/ExceptHandling1/Except4.py",
line 6, in MyExHook
tb.print_exception(typ, val, tb)
AttributeError: print_exception
--------------------------------------------------------------------------------------------------------
I can see that my MyExHook is being called (it wasn't being called when
I had previously set sys.excepthook = MyExHook without parameters). The
parameters to print_exception are what they should be.
What am I doing wrong?
Thanks,
Sami
_________________________________________________________________
Amazing prizes every hour with Live Search Big Snap
http://www.bigsnapsearch.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20080405/d77575e0/attachment.htm
More information about the python-win32
mailing list