I installed a sys.excepthook in my project at work that uses the logging module to record any uncaught exceptions. It didn't work.
I did what any lazy programmer would do: ask someone more experienced. "Do you have to set sys.excepthook in each thread?" I asked, more-or-less. "I don't think so," he replied.
Hmm. Maybe the developer I'd taken over from was setting excepthook later on in the initialization or somewhere else. ... Nope.
Finally I wrote this:
import sys, threading def log_exception(*args): print 'got exception %s' % (args,) sys.excepthook = log_exception def foo(): a = 1 / 0 threading.Thread(target=foo).start()
I belatedly googled "sys.excepthook threads." (I must have been a bit slow this morning to not do this first.) I was more than a little surprised to see my name in the first result that came back. (And a little disappointed that eight months later there's still no replies. :)
I've been a father for a couple years now, so I've gotten used to my memory being a little fuzzy now and then. But usually it's just, well, a bit fuzzy. I can tell that there are details I don't remember immediately, and they usually swim back if I think about it hard enough. But I don't remember posting that at all, nor can I recall what I was working on to prompt it. Funny. But also a little scary.