-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add xarray.backends.NoMatchingEngineError #5351
base: main
Are you sure you want to change the base?
Conversation
Fixes GH5329
@shoyer I have two suggestions:
import xarray as xr
try:
ds = xr.open_dataset(...)
except xr.NoMatchingEngineError:
...
|
@alexamici good points! I will revise this soon :) |
Hi, I see this was ready to merge, but I would like to still comment on the error message a bit. IMO, it should be emphasized a bit more that the file might not exist, which I suspect happens much more often than a backend missing. I came across this PR after me and a colleague struggled with opening a netCDF file for twenty minutes, trying to install different backends and such, until we realized that there was a typo in the filename we were trying to open. The error message could be something like:
It's a small change, but in the current version there is a risk that a beginner who knows nothing about storage backends gets stuck on "did not find a match in any of the installed backends" and goes on a wild goose chase installing packages like we did. |
How about inheriting from FileNotFoundError, this Exception type would be the first guess of people. |
pre-commit run --all-files
whats-new.rst
api.rst