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 1624527556,PR_kwDOAMm_X85MDcTr,7629,Raise PermissionError when insufficient permissions,15375218,closed,0,,,2,2023-03-15T00:56:58Z,2023-03-26T20:30:32Z,2023-03-26T20:30:31Z,CONTRIBUTOR,,0,pydata/xarray/pulls/7629,"- [x] Closes #6523 - [x] User visible changes (including notable bug fixes) are documented in `whats-new.rst` ### Previously ```bash (xr) $ chmod 000 testfile.nc (xr) $ python -c 'import xarray as xr f=xr.open_dataarray(""testfile.nc"").load()' MY_HOME/miniconda3/envs/xr/lib/python3.9/site-packages/xarray/backends/plugins.py:139: RuntimeWarning: 'netcdf4' fails while guessing warnings.warn(f""{engine!r} fails while guessing"", RuntimeWarning) MY_HOME/miniconda3/envs/xr/lib/python3.9/site-packages/xarray/backends/plugins.py:148: RuntimeWarning: 'netcdf4' fails while guessing warnings.warn(f""{engine!r} fails while guessing"", RuntimeWarning) MY_HOME/miniconda3/envs/xr/lib/python3.9/site-packages/xarray/backends/plugins.py:148: RuntimeWarning: 'h5netcdf' fails while guessing warnings.warn(f""{engine!r} fails while guessing"", RuntimeWarning) MY_HOME/miniconda3/envs/xr/lib/python3.9/site-packages/xarray/backends/plugins.py:148: RuntimeWarning: 'scipy' fails while guessing warnings.warn(f""{engine!r} fails while guessing"", RuntimeWarning) Traceback (most recent call last): File """", line 2, in File ""MY_HOME/miniconda3/envs/xr/lib/python3.9/site-packages/xarray/backends/api.py"", line 687, in open_dataarray dataset = open_dataset( File ""MY_HOME/miniconda3/envs/xr/lib/python3.9/site-packages/xarray/backends/api.py"", line 510, in open_dataset engine = plugins.guess_engine(filename_or_obj) File ""MY_HOME/miniconda3/envs/xr/lib/python3.9/site-packages/xarray/backends/plugins.py"", line 177, in guess_engine raise ValueError(error_msg) ValueError: did not find a match in any of xarray's currently installed IO backends ['netcdf4']. Consider explicitly selecting one of the installed engines via the ``engine`` parameter, or installing additional IO dependencies, see: https://docs.xarray.dev/en/stable/getting-started-guide/installing.html https://docs.xarray.dev/en/stable/user-guide/io.html ``` ### Now ```bash (xr) $ chmod 000 testfile.nc (xr) $ python -c 'import xarray as xr f=xr.open_dataarray(""testfile.nc"").load()' Traceback (most recent call last): File """", line 2, in File ""MY_HOME/miniconda3/envs/xr/lib/python3.9/site-packages/xarray/backends/api.py"", line 687, in open_dataarray dataset = open_dataset( File ""MY_HOME/miniconda3/envs/xr/lib/python3.9/site-packages/xarray/backends/api.py"", line 510, in open_dataset engine = plugins.guess_engine(filename_or_obj) File ""MY_HOME/miniconda3/envs/xr/lib/python3.9/site-packages/xarray/backends/plugins.py"", line 136, in guess_engine if backend.guess_can_open(store_spec): File ""MY_HOME/miniconda3/envs/xr/lib/python3.9/site-packages/xarray/backends/netCDF4_.py"", line 547, in guess_can_open magic_number = try_read_magic_number_from_path(filename_or_obj) File ""MY_HOME/miniconda3/envs/xr/lib/python3.9/site-packages/xarray/core/utils.py"", line 673, in try_read_magic_number_from_path with open(path, ""rb"") as f: PermissionError: [Errno 13] Permission denied: 'testfile.nc' ```","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7629/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 1358247997,PR_kwDOAMm_X84-Lgp-,6974,"Ensure encoding[""source""] is available for a pathlib.Path object",15375218,closed,0,,,3,2022-09-01T04:52:42Z,2023-03-01T19:12:12Z,2022-09-13T07:17:39Z,CONTRIBUTOR,,0,pydata/xarray/pulls/6974,"Closes #5888. At the moment if you pass a `Path` object, the `source` will not be encoded in, only if a string is passed in. Given there is already a function to handle this, `_normalize_path`, I've simplified the logic to just run that over the `str/Path` to ensure it is always encoded. - [x] Closes #5888 - [x] Tests added - [x] User visible changes (including notable bug fixes) are documented in `whats-new.rst` I'm not sure if this needs including in the `whats-new.rst`. I'm happy to add it if desired. ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/6974/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull