From 5490e2dd06cc71bd4a049f6c382674daf5aafef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Tue, 23 Aug 2022 14:48:24 +0200 Subject: [PATCH] Catch AttributeError --- astroid/interpreter/_import/spec.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/astroid/interpreter/_import/spec.py b/astroid/interpreter/_import/spec.py index ae363ae508..5b186b104d 100644 --- a/astroid/interpreter/_import/spec.py +++ b/astroid/interpreter/_import/spec.py @@ -372,9 +372,9 @@ def _find_spec_with_path( if spec: try: module_type = _MetaPathFinderModuleTypes[ - meta_finder.__name__ # type: ignore[attr-defined] + meta_finder.__name__ # type: ignore[attr-defined], caught by AttributeError ] - except KeyError: + except (KeyError, AttributeError): # If we don't recognise the finder, we assume it's a regular module module_type = ModuleType.PY_SOURCE return ( # type: ignore[return-value]