Couldn't Run the .py file | AttributeError: module 'collections' has no attribute 'MutableSequence'
Couldn't Run the .py file | AttributeError: module 'collections' has no attribute 'MutableSequence'
我正在处理 odx 文件,我有一个 generate.py 文件到 运行。我正在使用 pyXB。当我尝试 运行 时,我得到了这个。
*Traceback(最后一次调用):
文件“C:\Users\rohitkr\Downloads\starter_kit_adas-master\starter_kit_adas-master\devops\scripts\generate_odxf\generate_odxf.py”,第 15 行,在
中
从模式导入 odx
导入文件“C:\Users\rohitkr\Downloads\starter_kit_adas-master\starter_kit_adas-master\devops\scripts\generate_odxf\schema\odx.py”,第 9 行 pyxb.binding
文件“C:\Users\rohitkr\AppData\Local\Programs\Python\Python310\lib\site-packages\pyxb\binding_init_.py”,第 8 行,在
从 。导入数据类型
文件“C:\Users\rohitkr\AppData\Local\Programs\Python\Python310\lib\site-packages\pyxb\binding\datatypes.py”,第 1266 行,位于
只读存储器 。导入内容
文件“C:\Users\rohitkr\AppData\Local\Programs\Python\Python310\lib\site-packages\pyxb\binding\content.py”,第 807 行,位于
class _PluralBinding (collections.MutableSequence):
AttributeError: 模块 'collections' 没有属性 'MutableSequence'*
'''
可能是什么问题?
提前致谢。
在 python 3.10 中,MutableSequence 已从 collections
中删除,取而代之的是 collections.abc
Deprecated since version 3.3, will be removed in version 3.10: Moved Collections Abstract Base Classes to the collections.abc module. For backwards compatibility, they continue to be visible in this module through Python 3.9.
>>> from collections import MutableSequence
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
ImportError: cannot import name 'MutableSequence' from 'collections' (C:\Program Files\Python310\lib\collections\__init__.py)
>>> from collections.abc import MutableSequence
我正在处理 odx 文件,我有一个 generate.py 文件到 运行。我正在使用 pyXB。当我尝试 运行 时,我得到了这个。
*Traceback(最后一次调用):
文件“C:\Users\rohitkr\Downloads\starter_kit_adas-master\starter_kit_adas-master\devops\scripts\generate_odxf\generate_odxf.py”,第 15 行,在
中
从模式导入 odx
导入文件“C:\Users\rohitkr\Downloads\starter_kit_adas-master\starter_kit_adas-master\devops\scripts\generate_odxf\schema\odx.py”,第 9 行 pyxb.binding
文件“C:\Users\rohitkr\AppData\Local\Programs\Python\Python310\lib\site-packages\pyxb\binding_init_.py”,第 8 行,在 从 。导入数据类型
文件“C:\Users\rohitkr\AppData\Local\Programs\Python\Python310\lib\site-packages\pyxb\binding\datatypes.py”,第 1266 行,位于 只读存储器 。导入内容
文件“C:\Users\rohitkr\AppData\Local\Programs\Python\Python310\lib\site-packages\pyxb\binding\content.py”,第 807 行,位于 class _PluralBinding (collections.MutableSequence):
AttributeError: 模块 'collections' 没有属性 'MutableSequence'* '''
可能是什么问题? 提前致谢。
在 python 3.10 中,MutableSequence 已从 collections
中删除,取而代之的是 collections.abc
Deprecated since version 3.3, will be removed in version 3.10: Moved Collections Abstract Base Classes to the collections.abc module. For backwards compatibility, they continue to be visible in this module through Python 3.9.
>>> from collections import MutableSequence
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
ImportError: cannot import name 'MutableSequence' from 'collections' (C:\Program Files\Python310\lib\collections\__init__.py)
>>> from collections.abc import MutableSequence