I use an object __del__()to cancel it from an event (using an event scheme similar to this ):
import my_enviroment
class MyClass():
def __del__(self):
my_environment.events.my_event -= self.event_handler_func
Oddly enough, I got the following error at the end of the program launch:
Exception AttributeError: "'NoneType' object has no attribute 'events'" in <bound method MyClass.__del__ of <myclass.MyClass instance at 0x04C54580>> ignored
How is this possible? my_environmentis an imported module, how is it that it can be None? ( eventsis a global object in it with event hooks such as my_event)
source
share