netcdf4-python icon indicating copy to clipboard operation
netcdf4-python copied to clipboard

invalid argument reading error when running on a server

Open damdam2005 opened this issue 5 years ago • 2 comments
trafficstars

Hi, I would appreciate very much your help.

I have created my env miniconda on Linux:

conda create --name Python36-env python=3.6

conda activate Python36-env

conda install netcdf4

Then I am trying to run my script as:

python example.py

And I get the error:

File "Data_extraction.py", line 13, in nf = Dataset(mapIn,'r') #read netcdf file File "netCDF4/_netCDF4.pyx", line 2321, in netCDF4._netCDF4.Dataset.init File "netCDF4/_netCDF4.pyx", line 1885, in netCDF4._netCDF4._ensure_nc_success OSError: [Errno -36] NetCDF: Invalid argument: b'Y:/damdam/example.nc'

Lines in my script regarding netcfd4:

from netCDF4 import Dataset mapIn='Y:/damdam/example.nc' nf = Dataset(mapIn,'r') ids = len(nf.variables['river_cell'][:]) etc.

so when I do: conda list in cmp I see that I have my netcdf4 installed but when running on the server I get an error. If I run it locally on my computer I do not have any problem. That was the reason why I created virtual env on a server but the problem is still there.

Any suggestion? Thanks a lot,

Cheers

Marc

damdam2005 avatar Nov 18 '20 20:11 damdam2005

I have experienced this, too. The key thing to notice in the traceback is that the filename path string is being shown as a byte-string even though a byte string wasn't passed in. Somewhere in the process, the path string is getting converted into a byte string. I haven't figured out the exact circumstances, but it looks like the problem started with v1.6.1.

WeatherGod avatar Jan 20 '23 15:01 WeatherGod

Seeing that this issue was opened in 2020, well before the v1.6.1 release, this is probably not exactly the same as my bug, but I do think the byte-string is an important clue.

WeatherGod avatar Jan 20 '23 15:01 WeatherGod