home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 924559401

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
924559401 MDU6SXNzdWU5MjQ1NTk0MDE= 5489 Misleading error when opening file that does not exist 167164 closed 0     2 2021-06-18T05:37:39Z 2021-06-18T10:43:00Z 2021-06-18T10:43:00Z NONE      

What happened:

```python In [1]: import xarray as xr

In [2]: xr.version Out[2]: '0.18.2'

In [3]: xr.open_dataset('/not-a-real-file')

ValueError Traceback (most recent call last) <ipython-input-3-4cc5243e5a90> in <module> ----> 1 xr.open_dataset('/not-a-real-file')

~/miniconda3/envs/ana38/lib/python3.8/site-packages/xarray/backends/api.py in open_dataset(filename_or_obj, engine, chunks, cache, decode_cf, mask_and_scale, decode_times, decode_timedelta, use_cftime, concat_characters, decode_coords, drop_variables, backend_kwargs, args, *kwargs) 478 479 if engine is None: --> 480 engine = plugins.guess_engine(filename_or_obj) 481 482 backend = plugins.get_backend(engine)

~/miniconda3/envs/ana38/lib/python3.8/site-packages/xarray/backends/plugins.py in guess_engine(store_spec) 109 installed = [k for k in engines if k != "store"] 110 if installed: --> 111 raise ValueError( 112 "did not find a match in any of xarray's currently installed IO " 113 f"backends {installed}. Consider explicitly selecting one of the "

ValueError: did not find a match in any of xarray's currently installed IO backends ['netcdf4', 'scipy']. Consider explicitly selecting one of the installed backends via the engine parameter to xarray.open_dataset(), or installing additional IO dependencies: http://xarray.pydata.org/en/stable/getting-started-guide/installing.html http://xarray.pydata.org/en/stable/user-guide/io.html ```

What you expected to happen:

Should produce a "FileNotFound" error first.

Engine hunting on a non-existent file is pointless, and the error message is pretty wordy, so my skim-reading originally misinterpreted it to think that for some reason my netcdf4 library wasn't installed, which lead me on to a 4-hour environment rebuild, with a sudden realisation that I'm an idiot at the end of it...

Possible solution:

assert(os.path.isfile(path)) before anything else.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/5489/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 0.913ms · About: xarray-datasette