I was trying to pickle a State machine in order to save it on a file to be executed later and I saw that it cannot be pickled due to the _state_transitioning_lock variable. This could be fixed by adding the following to the state_machine class:
def __getstate__(self):
return {k:v for (k, v) in self.__dict__.items() if k is not "_state_transitioning_lock"}
def __setstate__(self, d):
self.__dict__ = d
self._state_transitioning_lock = threading.Lock()
I was trying to pickle a State machine in order to save it on a file to be executed later and I saw that it cannot be pickled due to the
_state_transitioning_lock
variable. This could be fixed by adding the following to the state_machine class: