Skip to content

Commit 7a654ad

Browse files
Exceptions are overlapping (#10446)
`ModuleNotFoundError` is a subclass of `ImportError`: https://docs.python.org/3/library/exceptions.html#exception-hierarchy
1 parent 5e4e18f commit 7a654ad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xarray/core/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ def attempt_import(module: str) -> ModuleType:
12921292
reason = package_purpose.get(package_name, "")
12931293
try:
12941294
return importlib.import_module(module)
1295-
except (ImportError, ModuleNotFoundError) as e:
1295+
except ImportError as e:
12961296
raise ImportError(
12971297
f"The {install_name} package is required {reason}"
12981298
" but could not be imported."

0 commit comments

Comments
 (0)