Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95845

Re: netcdf read

Path csiph.com!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'rename': 0.07; 'cc:addr :python-list': 0.09; 'imports': 0.09; 'nameerror:': 0.09; 'python': 0.10; 'files.': 0.13; 'wed,': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'numpy': 0.16; 'scripts.': 0.16; 'wrote:': 0.16; 'else,': 0.18; 'tells': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; '"",': 0.22; 'sep': 0.22; 'am,': 0.23; 'defined': 0.23; 'import': 0.24; '(most': 0.24; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'message- id:@mail.gmail.com': 0.27; 'this.': 0.28; 'finds': 0.29; 'windows,': 0.29; "i'm": 0.30; 'that.': 0.30; 'probably': 0.31; 'related': 0.32; 'run': 0.33; 'traceback': 0.33; 'windows.': 0.33; 'file': 0.34; 'running': 0.34; 'received:google.com': 0.35; 'something': 0.35; 'should': 0.36; 'subject:: ': 0.37; 'starting': 0.37; 'difference': 0.38; 'delete': 0.38; 'your': 0.60; 'between': 0.65; 'chrisa': 0.84; 'subject:read': 0.84; 'to:none': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=t2JZvNqztz99WeNq6G1JOpCgOTa7j1jtaoAmE4FrrKQ=; b=r/2cZRo+024FaZlWAilrPw0UXhrhW8K2USA9DIt3Wh5DtWbezy27BI8FoV/iVNfvWp fBVd1Peag5wzpkeU3WtQlwWn8jwRPy7tNhVewvinpx9eYMiuSv+DeZu0dPtLLuEJ76HE NPy2Mb+Cw3Vn0fX6Ti44cJo0uZqveYOxcuvMUpltTB1ziYCuocbmRO2EXeHYlvEFHrut uhYzP49fN3nO7s9SBCg1j1lR7K4CtuvVt2K5+OUkXBR6eChGSffXNfg4E5pn4M2x20Re liLLO7JceCPjJowJ5QBdP++0nm0Ls8Fr9hwQZNeN67yJUW7gnPdxWfH2Pa18QwWVzp4g DYEA==
MIME-Version 1.0
X-Received by 10.107.36.8 with SMTP id k8mr10656838iok.157.1441130872956; Tue, 01 Sep 2015 11:07:52 -0700 (PDT)
In-Reply-To <2af7b4226f66390b7027cca674bf0bcb@cptec.inpe.br>
References <2af7b4226f66390b7027cca674bf0bcb@cptec.inpe.br>
Date Wed, 2 Sep 2015 04:07:52 +1000
Subject Re: netcdf read
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.55.1441130882.23514.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1441130882 news.xs4all.nl 23851 [2001:888:2000:d::a6]:49444
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:95845

Show key headers only | View raw


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


Thread

Re: netcdf read Chris Angelico <rosuav@gmail.com> - 2015-09-02 04:07 +1000

csiph-web