vallettea / koala

Transpose your Excel calculations into python for better performances and scaling.
GNU General Public License v3.0
143 stars 60 forks source link

Cannot import name 'unicode' from 'openpyxl.compat' #241

Open stupy opened 4 years ago

stupy commented 4 years ago

In the Koala Module koala\ast__init__.py line 9 it; from openpyxl.compat import unicode The current version of openpyxl, openpyxl 3.0.0, does not have the module openpyxl.compat.unicode.

SlavaKozlov commented 4 years ago

I found the same issue with the following versions:

koala2=0.0.36 networkx=2.5

openpyxl.compat no longer supports the unicode type (aka Python 2 code).

The good thing is that in Python 3, the native str method is already unicode. Much of the code in koala that references unicode is mainly to switch between the two Python versions (is that correct?).

Now that Python 2 is no longer supported, it should be easier.

Until the bugfix is put into the repository, the fix I made locally is: replace the "from openpyxl.compat import unicode" line with "unicode = str" in all the koala files that have it.

There is also an issue with networkx no longer (>2.4) having a 'node' attribute. Replaced with "nodes" in koala/astnodes.py.