Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95845
| References | <2af7b4226f66390b7027cca674bf0bcb@cptec.inpe.br> |
|---|---|
| Date | 2015-09-02 04:07 +1000 |
| Subject | Re: netcdf read |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.55.1441130882.23514.python-list@python.org> (permalink) |
On Wed, Sep 2, 2015 at 3:23 AM, <jorge.conrado@cptec.inpe.br> wrote:
> I'm starting in the Python scripts. I run this script:
>
>
> import numpy as np
>
> import netCDF4
>
> f = netCDF4.Dataset('uwnd.mon.ltm.nc','r')
>
>
> f.variables
>
>
> and I had the message:
>
>
> netcdf4.py
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> NameError: name 'netcdf4' is not defined
>
>
> What can I do to solve this.
My crystal ball tells me you're probably running Windows.
On Windows, there's no difference between "netcdf4.py" and
"netCDF4.py", so when you ask Python to "import netCDF4", it finds
your program and imports that. To resolve this, just rename your
script to something else, and delete any "netcdf4.pyc" or related
files. Then try running it under the new name, and you should be fine.
ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: netcdf read Chris Angelico <rosuav@gmail.com> - 2015-09-02 04:07 +1000
csiph-web