Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State machines cannot be pickled #85

Open
InigoMoreno opened this issue Aug 5, 2021 · 0 comments
Open

State machines cannot be pickled #85

InigoMoreno opened this issue Aug 5, 2021 · 0 comments

Comments

@InigoMoreno
Copy link
Contributor

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()
InigoMoreno added a commit to InigoMoreno/executive_smach that referenced this issue Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant