kyper-data / python-highcharts

A simple translation layer between Python and Javascript for Highcharts projects (highcharts, highmaps, and highstocks).
MIT License
393 stars 190 forks source link

ImportError: cannot import name 'Iterable' from 'collections' in Python 3.10.5 #87

Open ishanwm opened 2 years ago

ishanwm commented 2 years ago

I just tried running the example in https://github.com/kyper-data/python-highcharts#example-usage in Python 3.10.5 and received error:

C:\Users\ihs\OneDrive - RWDI\work\misc\barnowl_data_processor>C:/Users/ihs/AppData/Local/Programs/Python/Python310/python.exe "c:/Users/ihs/OneDrive - RWDI/work/misc/barnowl_data_processor/barnowl_data_processor_ex4.py"
Traceback (most recent call last):
  File "c:\Users\ihs\OneDrive - RWDI\work\misc\barnowl_data_processor\barnowl_data_processor_ex4.py", line 6, in <module>
    from highcharts import Highchart
  File "C:\Users\ihs\AppData\Local\Programs\Python\Python310\lib\site-packages\highcharts\__init__.py", line 5, in <module>
    from .highcharts.highcharts import Highchart
  File "C:\Users\ihs\AppData\Local\Programs\Python\Python310\lib\site-packages\highcharts\highcharts\__init__.py", line 1, in <module>
    from .highcharts import Highchart
  File "C:\Users\ihs\AppData\Local\Programs\Python\Python310\lib\site-packages\highcharts\highcharts\highcharts.py", line 15, in <module>
    from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (C:\Users\ihs\AppData\Local\Programs\Python\Python310\lib\collections\__init__.py)
cenjui commented 1 year ago

Yup, newer versions of Python have changed the import statement for collections.

I've added a pull request to fix it. https://github.com/kyper-data/python-highcharts/pull/88

You can also fix it by downgrading your python install to 3.9 but then if something else wants 3.10 or higher it just gets messy.