diff --git a/pygmt/datasets/tile_map.py b/pygmt/datasets/tile_map.py index 44344d5903b..260232ba197 100644 --- a/pygmt/datasets/tile_map.py +++ b/pygmt/datasets/tile_map.py @@ -84,8 +84,8 @@ def load_tile_map(region, zoom="auto", source=None, lonlat=True, wait=0, max_ret Raises ------ - ModuleNotFoundError - If ``contextily`` is not installed. Follow + ImportError + If ``contextily`` is not installed or can't be imported. Follow :doc:`install instructions for contextily `, (e.g. via ``pip install contextily``) before using this function. @@ -109,7 +109,7 @@ def load_tile_map(region, zoom="auto", source=None, lonlat=True, wait=0, max_ret """ # pylint: disable=too-many-locals if contextily is None: - raise ModuleNotFoundError( + raise ImportError( "Package `contextily` is required to be installed to use this function. " "Please use `pip install contextily` or " "`conda install -c conda-forge contextily` " diff --git a/pygmt/figure.py b/pygmt/figure.py index 5f6740743df..7dd41ec76a2 100644 --- a/pygmt/figure.py +++ b/pygmt/figure.py @@ -8,7 +8,7 @@ try: import IPython -except ModuleNotFoundError: +except ImportError: IPython = None # pylint: disable=invalid-name diff --git a/pygmt/tests/test_figure.py b/pygmt/tests/test_figure.py index 2d5feaf676c..4cfe4ab9345 100644 --- a/pygmt/tests/test_figure.py +++ b/pygmt/tests/test_figure.py @@ -8,7 +8,7 @@ try: import IPython -except ModuleNotFoundError: +except ImportError: IPython = None # pylint: disable=invalid-name