python - How to get stack trace of exception happening in __del__? -
is there easy way stack trace printed exception happens in __del__? in case, there's no __del__ method defined object
exception typeerror: "'nonetype' object not callable" in <bound method interactivesession.__del__ of <tensorflow.python.client.session.interactivesession object @ 0x2867710>> ignored
you'd have detect error manually inside __del__:
def __del__(self): try: cleanup() except exception: import traceback traceback.print_exc() # let error keep propagating. raise there's no way configure python exceptions raised __del__. it's direct call pyerr_writeunraisable, no place provide callback, no configuration possible print stack trace, , retrieve exception information afterward.
Comments
Post a Comment