pythonedifact

Python edifact library won't work on windows 10


Hello and thanks in advance,

Python is a languge I don't often use but I am interested in an edifact library called pydifact I found on github. I run the example, it runs fine on linux but I get an error on windows 10... I used python 3.10

Traceback (most recent call last):
File "C:\Python\testApp.py", line 1, in <module>
from pydifact.segmentcollection import Interchange
File "c:\users\myname\pydifact\pydifact\__init__.py", line 23, in <module>
from pydifact import segmentcollection, parser, segments, serializer, token, 
tokenizer
File "c:\users\myname\pydifact\pydifact\segmentcollection.py", line 339, in <module>
class Interchange(FileSourcableMixin, UNAHandlingMixin, AbstractSegmentsContainer):
File "c:\users\myname\pydifact\pydifact\segmentcollection.py", line 425, in Interchange
cls, segments: Union[list, collections.Iterable]
AttributeError: module 'collections' has no attribute 'Iterable'

Any thoughts?


Solution

  • The line

    cls, segments: Union[list, collections.Iterable]
    

    which the error message mentions, indicates, that Iterable is not in collections module. Python deprecated colections.<smth> in favor of collections.abc.<smth> since version 3.3. Since 3.10 this deprecated behaviour is completely dropped and raises an error.

    So, you should downgrade to python 3.9 or eariler or replace all occurences of

    collections.Iterable
    

    to

    collections.abc.Iterable