python - Python edifact 库无法在 Windows 10 上运行
问题描述
您好,在此先感谢您,
Python 是一种我不经常使用的语言,但我对我在 github 上找到的一个名为pydifact的 edifact 库很感兴趣。我运行该示例,它在 linux 上运行良好,但在 windows 10 上出现错误...我使用了 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'
有什么想法吗?
解决方案
线
cls, segments: Union[list, collections.Iterable]
错误消息提到的,表明它Iterable
不在collections
模块中。自 3.3 版起colections.<smth>
,Python 被弃用。collections.abc.<smth>
从 3.10 开始,这种不推荐使用的行为被完全删除并引发错误。
因此,您应该降级到 python 3.9 或更早版本或替换所有出现的
collections.Iterable
到
collections.abc.Iterable
推荐阅读
- vscode-debugger - VSCode 在 Natvis 中访问本地创建的变量
- go - 大小为 1 的缓冲通道能否提供一个延迟发送保证?
- flutter - SocketException:主机查找失败:'methods.abc.com'(操作系统错误:没有与主机名关联的地址,errno = 7),StackTrace:
- vb.net - 在 VB.NET (Visual Studio 2013) 中使用 OLEDB 通过 DataGridView 更新访问数据库的按钮
- makefile - 如何修复 Visual Studio 2019 NMAKE 中的错误代码 U1000?
- gnu-make - 无法更新用作先决条件的变量
- google-cloud-platform - 如何允许团队成员使用我的 Google Cloud Speech-to-Text API 帐户?
- pine-script - Pine 脚本绘图线连接两条线
- python - 在 VScode 中调试 Python ( // 使用 IntelliSense 了解可能的属性。^ SyntaxError: invalid syntax )
- winapi - 我正在尝试使用 DeviceIoControl IOCTL_STORAGE_EJECT_MEDIA 弹出我的 CD ROM 驱动器,但出现错误访问冲突写入位置