Skip to content

Commit ae933fa

Browse files
authored
Replace ModuleNotFoundError with the more general ImportError (#2441)
1 parent df7b7cd commit ae933fa

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pygmt/datasets/tile_map.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ def load_tile_map(region, zoom="auto", source=None, lonlat=True, wait=0, max_ret
8484
8585
Raises
8686
------
87-
ModuleNotFoundError
88-
If ``contextily`` is not installed. Follow
87+
ImportError
88+
If ``contextily`` is not installed or can't be imported. Follow
8989
:doc:`install instructions for contextily <contextily:index>`, (e.g.
9090
via ``pip install contextily``) before using this function.
9191
@@ -109,7 +109,7 @@ def load_tile_map(region, zoom="auto", source=None, lonlat=True, wait=0, max_ret
109109
"""
110110
# pylint: disable=too-many-locals
111111
if contextily is None:
112-
raise ModuleNotFoundError(
112+
raise ImportError(
113113
"Package `contextily` is required to be installed to use this function. "
114114
"Please use `pip install contextily` or "
115115
"`conda install -c conda-forge contextily` "

pygmt/figure.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
try:
1010
import IPython
11-
except ModuleNotFoundError:
11+
except ImportError:
1212
IPython = None # pylint: disable=invalid-name
1313

1414

pygmt/tests/test_figure.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
try:
1010
import IPython
11-
except ModuleNotFoundError:
11+
except ImportError:
1212
IPython = None # pylint: disable=invalid-name
1313

1414

0 commit comments

Comments
 (0)