victorlei / smop

Small Matlab to Python compiler
MIT License
1.08k stars 409 forks source link

error on notebook 'DiGraph' object has no attribute 'node' #153

Open enaeini opened 4 years ago

enaeini commented 4 years ago

I get this error. Any thoughts please to help?

WARNING: Couldn't open 'parser.out'. [Errno 20] Not a directory: '/usr/local/lib/python3.6/dist-packages/smop-0.41b0-py3.6.egg/smop/parser.out' WARNING: Token 'CLASSDEF' defined, but not used WARNING: Token 'END_UNEXPECTED' defined, but not used WARNING: There are 2 unused tokens Generating LALR tables WARNING: Couldn't create 'parsetab'. [Errno 20] Not a directory: '/usr/local/lib/python3.6/dist-packages/smop-0.41b0-py3.6.egg/smop/parsetab.py' str Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/smop-0.41b0-py3.6.egg/smop/main.py", line 66, in main G = resolve.resolve(stmt_list) File "/usr/local/lib/python3.6/dist-packages/smop-0.41b0-py3.6.egg/smop/resolve.py", line 54, in resolve u = G.node[n]["ident"] AttributeError: 'DiGraph' object has no attribute 'node' Errors: 1

oryba commented 4 years ago

An easy fix would be pip install networkx==1.11. Just faced the same issue and this workaround helped. Networkx v2 is somewhat non-backward compatible with the version used here

DanHickstein commented 4 years ago

G.node needs to be changed to G.nodes in two places in resolve.py. This is due to a change in networkx, as mentioned by oryba. see https://github.com/dgorissen/pycel/issues/80

GBR-613 commented 2 years ago

Duplicating #165