On Wed, 23 Jul 2014 13:02:51 -0700, Jason Swails wrote: > I'm not sure how the "mylogger" variable is getting set to None in your > my_error_handler callback, but I don't see how that can possibly be > happening with the provided code...
Dammit, it's a Heisenbug... now it's gone away for me too. http://c2.com/cgi/wiki?HeisenBug However, I think I have a glimmer of an idea for how the global variable might be set to None. When the Python interpreter shuts down, it sets global variables to None in some arbitrary order. If the excepthook function isn't called until after the shutdown process begins, then depending on the phase of the moon, it's possible that ``mylogger`` may have been set to None by the time it is called. It's quite common for __del__ methods and daemon threads to be called during interpreter shutdown, but I've never come across an excepthook doing this. I wonder whether I ought to use atexit to register the function, rather than mess with sys.excepthook directly? -- Steven -- https://mail.python.org/mailman/listinfo/python-list