vallettea / koala

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

"from koala.ExcelCompiler" throws importError #206

Closed xiejen closed 5 years ago

xiejen commented 5 years ago

The stacktrace is: ... .6/site-packages/koala/reader.py", line 11, in from openpyxl.xml.functions import iterparse, fromstring, safe_iterator ImportError: cannot import name 'safe_iterator'

my Openpyxl is version 2.6.2

xiejen commented 5 years ago

It needs openpyxl 2.5.6, not the latest.

brianmay commented 5 years ago

I think anything earlier then 2.6.0 should work fine, including 2.5.14.

It looks like 2.6.0 dropped the safe_iterator function which is:

def safe_iterator(node, tag=None):
    """Return an iterator or an empty list"""
    if node is None:
        return []
    return node.iter(tag)
brianmay commented 5 years ago

I was debating filing a bug report against Openpyxl for dropping a function without documenting it in the changelog as being removed.

However, I can't find any reference to this function in the documentation for 2.5.14, so as a result, I suspect it was intended to be for internal use only.

Should be easy to fix by copying the above function into koala/reader.py I think.