Python

[Jupyter Notebook] AttributeError: module 'collections' has no attribute 'MutableMapping'

xojuholic 2022. 11. 25.
728x90
반응형

오류 원문이다.

AttributeError: module 'collections' has no attribute 'MutableMapping'

 

[Jupyter Notebook] ImportError: cannot import name 'MutableSet' from 'collections' (/usr/lib/python3.10/collections/__init__.py) 글 내용 적용하고 바로 맞닥트린 오류이다.

물론 코드는 동일하다.

File ~/.local/lib/python3.10/site-packages/arelle/pyparsing/pyparsing_py3.py:627
    624     def __dir__(self):
    625         return dir(super(ParseResults,self)) + self.keys()
--> 627 collections.MutableMapping.register(ParseResults)
    629 def col (loc,strg):
    630     """Returns current column within a string, counting newlines as line separators.
    631    The first column is number 1.
    632 
   (...)
    637    positions within the parsed string.
    638    """

AttributeError: module 'collections' has no attribute 'MutableMapping'

 

상기 오류 역시 [Jupyter Notebook] ImportError: cannot import name 'MutableSet' from 'collections' (/usr/lib/python3.10/collections/__init__.py) 경우와 동일한 이유라서 ~/.local/lib/python3.10/site-packages/arelle/pyparsing/pyparsing_py3.py 파일을 수정해줬다.

      1 from __future__ import print_function
----> 2 from collections.abc import MutableMapping		# 새롭게 추가
      3
      4 __doc__ = \
   (...)
    628 # collections.MutableMapping.register(ParseResults)	# 기존 오류 구문 주석 처리
--> 629 collections.abc.MutableMapping.register(ParseResults)	# 새롭게 추가

 

728x90
반응형
SMALL

댓글

💲 추천 글