Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve the error message when pooch is not installed #5312

Merged
merged 3 commits into from
May 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ io =
cftime
rasterio
cfgrib
pooch
## Scitools packages & dependencies (e.g: cartopy, cf-units) can be hard to install
# scitools-iris

Expand Down
14 changes: 10 additions & 4 deletions xarray/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ def open_dataset(
"""
try:
import pooch
except ImportError:
raise ImportError("using the tutorial data requires pooch")
except ImportError as e:
raise ImportError(
"tutorial.open_dataset depends on pooch to download and manage datasets."
" To proceed please install pooch."
) from e

logger = pooch.get_logger()
logger.setLevel("WARNING")
Expand Down Expand Up @@ -146,8 +149,11 @@ def open_rasterio(
"""
try:
import pooch
except ImportError:
raise ImportError("using the tutorial data requires pooch")
except ImportError as e:
raise ImportError(
"tutorial.open_rasterio depends on pooch to download and manage datasets."
" To proceed please install pooch."
) from e

logger = pooch.get_logger()
logger.setLevel("WARNING")
Expand Down