You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For my first use, after successfully fighting with dependencies, I ran into this error:
Traceback (most recent call last):
File "/Users/x/venv/bin/code2flow", line 8, in <module>
sys.exit(main())
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/engine.py", line 874, in main
level=level,
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/engine.py", line 737, in code2flow
skip_parse_errors, lang_params)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/engine.py", line 478, in map_it
file_group = make_file_group(file_ast_tree, source, extension)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/engine.py", line 359, in make_file_group
file_group.add_node(language.make_root_node(body_trees, parent=file_group), is_root=True)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 372, in make_root_node
calls = make_calls(lines)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 105, in make_calls
for element in walk(body):
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 35, in walk
ret += walk(el)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 42, in walk
ret += walk(v)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 35, in walk
ret += walk(el)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 40, in walk
ret += walk(v)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 40, in walk
ret += walk(v)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 42, in walk
ret += walk(v)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 35, in walk
ret += walk(el)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 40, in walk
ret += walk(v)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 42, in walk
ret += walk(v)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 35, in walk
ret += walk(el)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 42, in walk
ret += walk(v)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 35, in walk
ret += walk(el)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 40, in walk
ret += walk(v)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 42, in walk
ret += walk(v)
File "/Users/x/venv/lib/python3.7/site-packages/code2flow/javascript.py", line 33, in walk
if el.get('type'):
AttributeError: 'NoneType' object has no attribute 'get'
Steps to reproduce:
Install needed dependencies
Run code2flow *.js workflows/*.js bin/*.js --output out.dot in corresponding arborescence root
I used a collection of JS files, separated into multiple folders.
As the code stated, I suspect a bug inside the tool itself. Is there anything to fix this?
Thanks
The text was updated successfully, but these errors were encountered:
I've just faced the same problem and the only help found so far is your own unanswered question!
I have had a look to the …/code2flow/javascript.py file, and it appears that the related line (n 33) makes a test that may not be protected enough.
I just tried to replace it as follow:
--- /[…]/lib/python3.10/site-packages/code2flow/javascript.py.original 2024-03-05 14:49:51.895071571 +0100+++ /[…]/lib/python3.10/site-packages/code2flow/javascript.py 2024-03-05 14:42:55.807765683 +0100@@ -31,5 +31,5 @@ def walk(tree):
if type(tree) == list:
for el in tree:
- if el.get('type'):+ if el and el.get('type'):
ret.append(el)
ret += walk(el)
(just adds a test to check if el could be equal to None…)
By the way, that fixed the problem for me in some cases, but code2flow still crashes in some other cases.
Hello,
For my first use, after successfully fighting with dependencies, I ran into this error:
Steps to reproduce:
code2flow *.js workflows/*.js bin/*.js --output out.dot
in corresponding arborescence rootI used a collection of JS files, separated into multiple folders.
As the code stated, I suspect a bug inside the tool itself. Is there anything to fix this?
Thanks
The text was updated successfully, but these errors were encountered: