提前向您问好并表示感谢,
Python是一种我不经常使用的语言,但我对我在github上找到的一个名为pydifact的edifact库很感兴趣。我运行了这个例子,它在linux上运行良好,但在Windows10上出现错误...我用的是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'有什么想法吗?
发布于 2021-10-18 09:50:15
这条线
cls, segments: Union[list, collections.Iterable]错误消息提到,这表明Iterable不在collections模块中。Python从3.3版本开始就弃用了colections.<smth>,转而支持collections.abc.<smth>。从3.10开始,这种不推荐使用的行为被完全删除,并引发错误。
因此,您应该降级到python 3.9或更早版本,或者替换所有出现的
collections.Iterable至
collections.abc.Iterablehttps://stackoverflow.com/questions/69613875
复制相似问题