sentry icon indicating copy to clipboard operation
sentry copied to clipboard

AttributeError: module 'collections' has no attribute 'MutableMapping' in Python 3.12

Open dev-msln opened this issue 1 year ago • 1 comments

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

1- install a Django project with Python3.12 docker image. 2- install the sentry-sdk latest version (pip install sentry-sdk==2.2.0) 3- add sentry to django setting 4- run the django project and you face the error

Expected Result

Django should start without any issues. On Python 3.9 it was fine. recently I upgraded Python version to 3.12 in my project and after that, it won't work.

Python 3.12 Django 4.2

Actual Result

import sentry_sdk File "/usr/local/lib/python3.12/site-packages/sentry_sdk/init.py", line 1, in from sentry_sdk.hub import Hub, init File "/usr/local/lib/python3.12/site-packages/sentry_sdk/hub.py", line 5, in from sentry_sdk.scope import Scope, _ScopeManager File "/usr/local/lib/python3.12/site-packages/sentry_sdk/scope.py", line 11, in from sentry_sdk.attachments import Attachment File "/usr/local/lib/python3.12/site-packages/sentry_sdk/attachments.py", line 5, in from sentry_sdk.envelope import Item, PayloadRef File "/usr/local/lib/python3.12/site-packages/sentry_sdk/envelope.py", line 6, in from sentry_sdk.session import Session File "/usr/local/lib/python3.12/site-packages/sentry_sdk/session.py", line 5, in from sentry_sdk.utils import format_timestamp File "/usr/local/lib/python3.12/site-packages/sentry_sdk/utils.py", line 1302, in HAS_REAL_CONTEXTVARS, ContextVar = _get_contextvars() ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/sentry_sdk/utils.py", line 1272, in _get_contextvars if not _is_contextvars_broken(): ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/sentry_sdk/utils.py", line 1213, in _is_contextvars_broken from eventlet.patcher import is_monkey_patched # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/eventlet/init.py", line 6, in from eventlet import convenience File "/usr/local/lib/python3.12/site-packages/eventlet/convenience.py", line 7, in from eventlet.green import socket File "/usr/local/lib/python3.12/site-packages/eventlet/green/socket.py", line 21, in from eventlet.support import greendns File "/usr/local/lib/python3.12/site-packages/eventlet/support/greendns.py", line 78, in setattr(dns, pkg, import_patched('dns.' + pkg)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/eventlet/support/greendns.py", line 60, in import_patched return patcher.import_patched(module_name, **modules) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/eventlet/patcher.py", line 132, in import_patched return inject( ^^^^^^^ File "/usr/local/lib/python3.12/site-packages/eventlet/patcher.py", line 109, in inject module = import(module_name, {}, {}, module_name.split('.')[:-1]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dns/namedict.py", line 35, in class NameDict(collections.MutableMapping): ^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'collections' has no attribute 'MutableMapping'

Product Area

Unknown

Link

No response

DSN

https://lk-xo.sentry.io/projects/backend-lk/

Version

No response

dev-msln avatar May 19 '24 10:05 dev-msln