Re: netcdf read

2015-09-01 Thread Jason Swails
On Tue, Sep 1, 2015 at 2:07 PM, Chris Angelico  wrote:

> On Wed, Sep 2, 2015 at 3:23 AM,   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 "", line 1, in 
> > NameError: name 'netcdf4' is not defined
> >
> >
> > What can I do to solve this.
>
> My crystal ball tells me you're probably running Windows.
>

​Or Mac OS X.  Unless you go out of your way to specify otherwise, the
default OS X filesystem is case-insensitive.

All the best,
Jason
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: netcdf read

2015-09-01 Thread Chris Angelico
On Wed, Sep 2, 2015 at 3:23 AM,   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 "", line 1, in 
> 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
-- 
https://mail.python.org/mailman/listinfo/python-list