Hi, I am using python 2.5 and trying to use an self defined excepthook in my program. In the main thread it works perfectly fine but in an thread started with the threading module the usual excepthook is called.
Here is a example showing the problem. Uncommenting the comment shows the desired behaviour.
import threading, sys
def myexcepthook(type, value, tb):
print 'myexcepthook'
class A(threading.Thread, object):
def __init__(self):
threading.Thread.__init__(self, verbose=True)
# raise Exception('in main')
self.start()
def run(self):
print 'A'
raise Exception('in thread')
if __name__ == "__main__":
sys.excepthook = myexcepthook
A()
How can i use my own excepthook in a thread? regards Sebastian