You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [1]: importxarrayasxrIn [2]: xr.__version__Out[2]: '0.18.2'In [3]: xr.open_dataset('/not-a-real-file')
---------------------------------------------------------------------------ValueErrorTraceback (mostrecentcalllast)
<ipython-input-3-4cc5243e5a90>in<module>---->1xr.open_dataset('/not-a-real-file')
~/miniconda3/envs/ana38/lib/python3.8/site-packages/xarray/backends/api.pyinopen_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)
478479ifengineisNone:
-->480engine=plugins.guess_engine(filename_or_obj)
481482backend=plugins.get_backend(engine)
~/miniconda3/envs/ana38/lib/python3.8/site-packages/xarray/backends/plugins.pyinguess_engine(store_spec)
109installed= [kforkinenginesifk!="store"]
110ifinstalled:
-->111raiseValueError(
112"did not find a match in any of xarray's currently installed IO "113f"backends {installed}. Consider explicitly selecting one of the "ValueError: didnotfindamatchinanyofxarray's currently installed IO backends ['netcdf4', 'scipy']. Considerexplicitlyselectingoneoftheinstalledbackendsviathe``engine``parametertoxarray.open_dataset(), orinstallingadditionalIOdependencies:
http://xarray.pydata.org/en/stable/getting-started-guide/installing.htmlhttp://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.
The text was updated successfully, but these errors were encountered:
I think there's more to think of then the suggested solution. For example when opening remote datasets (e.g. OPeNDAP resources), the supplied path will be a string which does not refer to a local path. The decision if a supplied "path" is valid might thus require to find an appropriate IO backend and then ask the backend if the supplied "path" is a valid one.
What happened:
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.The text was updated successfully, but these errors were encountered: