diff --git a/sentry_sdk/integrations/threading.py b/sentry_sdk/integrations/threading.py index 6311b935a0..5b5633507f 100644 --- a/sentry_sdk/integrations/threading.py +++ b/sentry_sdk/integrations/threading.py @@ -54,11 +54,14 @@ def setup_once() -> None: try: from django import VERSION as django_version # noqa: N811 + except ImportError: + django_version = None + + try: import channels # type: ignore[import-untyped] channels_version = channels.__version__ - except ImportError: - django_version = None + except (ImportError, AttributeError): channels_version = None is_async_emulated_with_threads = (