Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'DiGraph' object has no attribute 'node' #260

Open
xiejen opened this issue Jun 17, 2021 · 1 comment
Open

AttributeError: 'DiGraph' object has no attribute 'node' #260

xiejen opened this issue Jun 17, 2021 · 1 comment

Comments

@xiejen
Copy link

xiejen commented Jun 17, 2021

I upgraded my python version from 3.6 to 3.7. The code below throws error:

from koala.ExcelCompiler import ExcelCompiler
from koala.Spreadsheet import Spreadsheet
sp = Spreadsheet("data/Data Warehouse T-Shirt Size.xlsx")

The error is:

File "graphTSizeXlsx.py", line 12, in <module>
    sp = Spreadsheet("data/Data Warehouse T-Shirt Size.xlsx")
  File "/Users/zhengxie1/workspace/extractTsizeDataLake/venv/lib/python3.7/site-packages/koala/Spreadsheet.py", line 67, in __init__
    self.gen_graph()
  File "/Users/zhengxie1/workspace/extractTsizeDataLake/venv/lib/python3.7/site-packages/koala/Spreadsheet.py", line 134, in gen_graph
    cellmap, G = graph_from_seeds(seeds, self)
  File "/Users/zhengxie1/workspace/extractTsizeDataLake/venv/lib/python3.7/site-packages/koala/ast/__init__.py", line 473, in graph_from_seeds
    pystr, ast = cell2code(c1, names)
  File "/Users/zhengxie1/workspace/extractTsizeDataLake/venv/lib/python3.7/site-packages/koala/ast/__init__.py", line 374, in cell2code
    code = root.emit(ast, context=sheet)
  File "/Users/zhengxie1/workspace/extractTsizeDataLake/venv/lib/python3.7/site-packages/koala/ast/astnodes.py", line 301, in emit
    args = self.children(ast)
  File "/Users/zhengxie1/workspace/extractTsizeDataLake/venv/lib/python3.7/site-packages/koala/ast/astnodes.py", line 45, in children
    args = sorted(args,key=lambda x: ast.node[x]['pos'])
  File "/Users/zhengxie1/workspace/extractTsizeDataLake/venv/lib/python3.7/site-packages/koala/ast/astnodes.py", line 45, in <lambda>
    args = sorted(args,key=lambda x: ast.node[x]['pos'])
AttributeError: 'DiGraph' object has no attribute 'node'

I have the latest version:

$ pip install update koala2
Requirement already satisfied: update in ./venv/lib/python3.7/site-packages (0.0.1)
Requirement already satisfied: koala2 in ./venv/lib/python3.7/site-packages (0.0.35)
Requirement already satisfied: style==1.1.0 in ./venv/lib/python3.7/site-packages (from update) (1.1.0)
Requirement already satisfied: six>=1.11.0 in ./venv/lib/python3.7/site-packages (from koala2) (1.15.0)
Requirement already satisfied: openpyxl>=2.5.3 in ./venv/lib/python3.7/site-packages (from koala2) (2.5.14)
Requirement already satisfied: Cython>=0.28.2 in ./venv/lib/python3.7/site-packages (from koala2) (0.29.22)
Requirement already satisfied: networkx>=2.1 in ./venv/lib/python3.7/site-packages (from koala2) (2.5)
Requirement already satisfied: lxml>=4.1.1 in ./venv/lib/python3.7/site-packages (from koala2) (4.6.2)
Requirement already satisfied: numpy>=1.14.2 in ./venv/lib/python3.7/site-packages (from koala2) (1.20.1)
Requirement already satisfied: decorator>=4.3.0 in ./venv/lib/python3.7/site-packages (from networkx>=2.1->koala2) (4.4.2)
Requirement already satisfied: jdcal in ./venv/lib/python3.7/site-packages (from openpyxl>=2.5.3->koala2) (1.4.1)
Requirement already satisfied: et-xmlfile in ./venv/lib/python3.7/site-packages (from openpyxl>=2.5.3->koala2) (1.0.1)
@aegis1980
Copy link

Try (as temp fix):

pip uninstall networkx

then

pip install networkx==2.1

Looking at Koala's setup.py file:

install_requires=[
   'networkx >= 2.1',
    ...
]

The current version on networkx is 2.6.3 so i guess something broke between 2.1 & 2.6.3, so....

install_requires=[
   'networkx == 2.1',
    ...
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants