Reputation: 55
I am working with odx files and I have a generate.py file to run. I am using pyXB. When I try to run I am getting this.
*Traceback (most recent call last):
File "C:\Users\rohitkr\Downloads\starter_kit_adas-master\starter_kit_adas-master\devops\scripts\generate_odxf\generate_odxf.py", line 15, in
from schema import odx
File "C:\Users\rohitkr\Downloads\starter_kit_adas-master\starter_kit_adas-master\devops\scripts\generate_odxf\schema\odx.py", line 9, in import pyxb.binding
File "C:\Users\rohitkr\AppData\Local\Programs\Python\Python310\lib\site-packages\pyxb\binding_init_.py", line 8, in from . import datatypes
File "C:\Users\rohitkr\AppData\Local\Programs\Python\Python310\lib\site-packages\pyxb\binding\datatypes.py", line 1266, in rom . import content
File "C:\Users\rohitkr\AppData\Local\Programs\Python\Python310\lib\site-packages\pyxb\binding\content.py", line 807, in class _PluralBinding (collections.MutableSequence):
AttributeError: module 'collections' has no attribute 'MutableSequence'* '''
What could be the problem? Thanks in advance.
Upvotes: 3
Views: 11757
Reputation: 1431
If you don't want to change the source code, there is an easier way. Just use this in your script after importing.
import collections
collections.MutableSequence = collections.abc.MutableSequence
Upvotes: 7
Reputation: 3503
In python 3.10 MutableSequence was removed from collections
in favor of 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
Upvotes: 10