In version 0.8.3 it is not possible to start the state machine in a nested state. Instead an exception is raised.
The error can be reproduced using a modified version of the example from README.md
Creating the instance of Machine raises an exception with this trace:
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/username/.vscode/extensions/ms-python.python-2020.9.112786/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module>
cli.main()
File "/Users/username/.vscode/extensions/ms-python.python-2020.9.112786/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 430, in main
run()
File "/Users/username/.vscode/extensions/ms-python.python-2020.9.112786/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 267, in run_file
runpy.run_path(options.target, run_name=compat.force_str("__main__"))
File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/username/development/localhost/python-transitions-0.8.3-test/test.py", line 12, in <module>
machine = Machine(states=states, transitions=transitions, initial='caffeinated_dithering', ignore_invalid_triggers=True)
File "/Users/username/.virtualenvs/transitions-venv/lib/python3.8/site-packages/transitions/extensions/nesting.py", line 337, in __init__
_super(HierarchicalMachine, self).__init__(*args, **kwargs)
File "/Users/username/.virtualenvs/transitions-venv/lib/python3.8/site-packages/transitions/core.py", line 568, in __init__
self.initial = initial
File "/Users/username/.virtualenvs/transitions-venv/lib/python3.8/site-packages/transitions/core.py", line 639, in initial
self.add_state(state_name)
File "/Users/username/.virtualenvs/transitions-venv/lib/python3.8/site-packages/transitions/core.py", line 740, in add_state
self.add_states(*args, **kwargs)
File "/Users/username/.virtualenvs/transitions-venv/lib/python3.8/site-packages/transitions/extensions/nesting.py", line 434, in add_states
self.add_states(domains[1], on_enter=on_enter, on_exit=on_exit, ignore_invalid_triggers=ignore_invalid_triggers, **kwargs)
File "/Users/username/.virtualenvs/transitions-venv/lib/python3.8/site-packages/transitions/extensions/nesting.py", line 437, in add_states
raise ValueError("State {0} cannot be added since it already exists.".format(state))
ValueError: State dithering cannot be added since it already exists.
Up to version 0.7.2 it was possible to start a state machine in a nested state and I would except the same for the newer versions.
In version 0.8.3 it is not possible to start the state machine in a nested state. Instead an exception is raised. The error can be reproduced using a modified version of the example from README.md
Creating the instance of
Machine
raises an exception with this trace:Up to version 0.7.2 it was possible to start a state machine in a nested state and I would except the same for the newer versions.