nerdocs / pydifact

A python EDIFACT library.
MIT License
156 stars 45 forks source link

module 'collections' has no attribute 'Iterable' #46

Closed Mikel0303 closed 3 years ago

Mikel0303 commented 3 years ago

"import pydifact" failed as module 'collections' does not seem to have an attribute 'Iterable'.

following the error message

File "/Users/mike2/Documents/Python3/EDI1.py", line 3, in from pydifact.segmentcollection import Interchange File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pydifact/init.py", line 23, in from pydifact import segmentcollection, parser, segments, serializer, token, tokenizer File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pydifact/segmentcollection.py", line 382, in class Interchange(FileSourcableMixin, UNAHandlingMixin, AbstractSegmentsContainer): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pydifact/segmentcollection.py", line 498, in Interchange cls, segments: Union[list, collections.Iterable] AttributeError: module 'collections' has no attribute 'Iterable'

nerdoc commented 3 years ago

Hmmm. this has to do with your Python version. It seems that collections.Iterable is deprecated since Python 3.9.

I removed from collections import Iterable according to deprecation warnings, and use from collections.abc import Iterable directly.

@Mikel0303 could you check this with your Python 3.10 version - with the newest git - then I make a bugfix release ASAP.

Wauplin commented 2 years ago

Hi @nerdoc, thank you for this quick fix. I encountered the exact same issue when I upgraded the python version to 3.10. I tested to install pydifact from the git repo latest commit and it worked perfectly. No errors and no deprecation warnings anymore. Could you make the bugfix release ? Thanks in advance and have a good day :slightly_smiling_face:

nerdoc commented 2 years ago

OK, later today evening.

nerdoc commented 2 years ago

Done. @Wauplin @Mikel0303

Wauplin commented 2 years ago

Thanks !