Description
When I run the 'Loops and interrupts' example in doc
I got a error:
Traceback (most recent call last):
File "C:\Python35-32\lib\site-packages\workflow\engine.py", line 542, in _process
e.class.name
AttributeError: type object 'TransitionActions' has no attribute 'KeyError'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 5.0.5\helpers\pydev\pydevd.py", line 2411, in
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Program Files (x86)\JetBrains\PyCharm 5.0.5\helpers\pydev\pydevd.py", line 1802, in run
new data: [0]
new data: [0, 1]
launch(file, globals, locals) # execute the script
File "C:\Program Files (x86)\JetBrains\PyCharm 5.0.5\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:/4delete/demo_workflow2/demo_control_wf.py", line 84, in
my_engine.process([[], [0, 1], [0, 1, 0, 1]]) # handle multi-tokens in same workflow one-by-one.
File "C:\Python35-32\lib\site-packages\workflow\engine.py", line 390, in process
self._process(objects)
File "C:\Python35-32\lib\site-packages\workflow\engine.py", line 547, in _process
obj, self, callbacks, exc_info
File "C:\Python35-32\lib\site-packages\workflow\engine.py", line 970, in Exception
reraise(_exc_info)
File "C:\Python35-32\lib\site-packages\six.py", line 686, in reraise
raise value
File "C:\Python35-32\lib\site-packages\workflow\engine.py", line 529, in _process
self.run_callbacks(callbacks, objects, obj)
File "C:\Python35-32\lib\site-packages\workflow\engine.py", line 465, in run_callbacks
indent + 1)
File "C:\Python35-32\lib\site-packages\workflow\engine.py", line 481, in run_callbacks
self.execute_callback(callback_func, obj)
File "C:\Python35-32\lib\site-packages\workflow\engine.py", line 564, in execute_callback
callback(obj, self)
File "C:\Python35-32\lib\site-packages\workflow\patterns\controlflow.py", line 326, in _for
eng.extra_data["_Iterators"][step]["previous_data"])
_KeyError: 'previous_data'*
Finally I catched the bug in 'controlflow.py' LINE303:
the follow code block MUST be out of 'if step not in eng.extra_data["_Iterators"]:'
# Store previous data
if 'current_data' in eng.extra_data["_Iterators"][step]:
eng.extra_data["_Iterators"][step]["previous_data"] = \
eng.extra_data["_Iterators"][step]["current_data"]
Is that right?