def __del__(self): # don't know why this try is necessary, but I get an exception without # it try: self.clear_callbacks() BaseObject.__del__(self) except: pass