Skip to content

Instantly share code, notes, and snippets.

@fabb fabb/gist:5014867
Last active Dec 14, 2015

Embed
What would you like to do?
Seemingly buggy behavior with PySCXML: the second event "f" is not received in most executions
import time
from scxml.pyscxml import StateMachine
import logging
logging.basicConfig(level=logging.NOTSET) # show detailed debug info
xml = '''
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" datamodel="python" initial="S1">
<state id="S1">
<onentry>
<log expr="'hello S1'"/>
</onentry>
<transition event="s2" target="S2">
<log expr="'transition s2 from S1 to S2'" />
</transition>
<onexit>
<log expr="'bye S1'"/>
</onexit>
</state>
<state id="S2">
<onentry>
<log expr="'hello S2'"/>
</onentry>
<transition event="f" target="F">
<log expr="'transition f from S2 to F'" />
</transition>
<onexit>
<log expr="'bye S2'"/>
</onexit>
</state>
<final id="F">
<onentry>
<log expr="'hello F'"/>
</onentry>
</final>
</scxml>
'''
sm = StateMachine(xml)
sm.start_threaded()
sm.send("s2")
#time.sleep(1) #problem does not occur when sleeping in between
sm.send("f") #event is ignored in most executions, statemachine stays in state S2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.