Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95845 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2015-09-02 04:07 +1000 |
| Last post | 2015-09-02 04:07 +1000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: netcdf read Chris Angelico <rosuav@gmail.com> - 2015-09-02 04:07 +1000
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-09-02 04:07 +1000 |
| Subject | Re: netcdf read |
| Message-ID | <mailman.55.1441130882.23514.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web