Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error initializing a nco object #120

Open
kawtherOuenniche opened this issue Mar 14, 2019 · 4 comments
Open

error initializing a nco object #120

kawtherOuenniche opened this issue Mar 14, 2019 · 4 comments
Assignees

Comments

@kawtherOuenniche
Copy link

Hi, I'm trying to use nco on google colab but when I iniatialize the object nco = Nco() it raises the error

/usr/local/lib/python3.6/dist-packages/nco/nco.py in init(self, returnCdf, return_none_on_error, force_output, cdf_module, debug, **kwargs)
56 self.nco_path = os.environ["NCOpath"]
57 else:
---> 58 self.nco_path = os.path.split(distutils.spawn.find_executable("ncks"))[0]
59
60 self.operators = operators

/usr/lib/python3.6/posixpath.py in split(p)
105 """Split a pathname. Returns tuple "(head, tail)" where "tail" is
106 everything after the final slash. Either part may be empty."""
--> 107 p = os.fspath(p)
108 sep = _get_sep(p)
109 i = p.rfind(sep) + 1

TypeError: expected str, bytes or os.PathLike object, not NoneType

What am I supposed to do ?

@Jcampbell-8
Copy link

Jcampbell-8 commented Jul 2, 2021

I have the same exact issue and am not coming up with a solution as of yet. Trying to import it into a Jupyter Notebook using python, but same exact error and nco=Nco() operator after importing nco.

@czender
Copy link
Member

czender commented Jul 4, 2021

I am not very familiar with these issues, but this discussion seems relevant: https://stackoverflow.com/questions/68227959/error-using-nco-in-jupyter-notebook-not-loading-gives-error-typeerror-after-co
I suggest setting NCOpath to the directory of ncks on your system with, e.g.,
export NCOpath='/usr/local/bin'
Perhaps @hmb1 has an idea too...

@Jcampbell-8
Copy link

Thanks @czender, that stack discussion is actually my discussion. The ncks seems to be only contained inside my conda environment. Does that need to be installed somewhere else? I set the path as you suggested but still no luck.

@czender
Copy link
Member

czender commented Jul 6, 2021

I think NCO and pyNCO are separate installations. Did you install NCO? If so, then pyNCO should find it if you set NCOpath to the directory containing the ncks executable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants