pynco icon indicating copy to clipboard operation
pynco copied to clipboard

Error of expected str, bytes or os.PathLike object, not NoneType

Open Niilavarnam opened this issue 1 year ago • 1 comments

Hello!

I want to use nco to process netcdf files. I have debian, and I have created a virtual environment, and I have installed nco with pip install. And it installed fine. But I don't know why it doesn't work, not even the example of the web https://pypi.org/project/nco/:

from nco import Nco nco = Nco() temperatures = nco.ncra(input='input.nc', returnCdf=True).variables['T'][:]

this is the error I get: Traceback (most recent call last): File "/home/tlopez/Work_BEC/02_Python/BEC_Script/t_Try_Code.py", line 2, in nco = Nco() ^^^^^ File "/home/usr-t/Work/Python/Script/lib/python3.11/site-packages/nco/nco.py", line 55, in init self.nco_path = os.path.split(shutil.which("ncks"))[0] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 103, in split TypeError: expected str, bytes or os.PathLike object, not NoneType

Niilavarnam avatar Aug 02 '24 06:08 Niilavarnam

HI Niilavarnam You need to have the ncks operators in your path (the env variable PATH). In terminal try typing ncks and see what you get ?

....Henry

hmb1 avatar Aug 02 '24 09:08 hmb1