Skip to content

Insufficient permissions raise IO ValueError instead of PermissionError #6523

Closed
@BorjaEst

Description

@BorjaEst

What is your issue?

I was getting the following error continuously when using xarray.open_mfdataset:

ValueError: did not find a match in any of xarray's currently installed IO backends ['netcdf4', 'h5netcdf', 'scipy', 'cfgrib', 'pydap', 'zarr']. Consider explicitly selecting one of the installed engines via the ``engine`` parameter, or installing additional IO dependencies

When the file file was indeed a netcdf4:

$ ncdump -k myfile.nc 
classic

I was running my script with the command inside a docker container, which uses a different user and group than myself. It seems the issue was on the permisions of the file as only my user had access:

$ ls -la
total 39M
-rw-r----- 1 borja borja 39M Mär 23 12:15 myfile.nc

Changing permission rights with chmod a+r myfile.nc solved the thing:

$ ls -la
total 39M
-rw-r--r-- 1 borja borja 39M Mär 23 12:15 myfile.nc

The permission thing is perfectly fine, it was my error, however, it would be nice that the command open_mfdataset (or related) would raise PermissionError when permissions are not sufficient.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions