Scenario resolved:
startup() fails and some variables are never initialised. those are used in overridden send_stats() which is called from generic exception handler in run_func_safely(). thus a new exception is raised that would obscure the original exception raised in startup().
self.reset()
sys.exit(1)
except Exception, d:
- self.send_stats()
+ try: # this may fail too
+ self.send_stats()
+ except:
+ pass
emsg = str(d).rstrip()
self.reset()
self.exception_hook(d, emsg)