<p dir="ltr">Where are you running the code from?</p>
<p dir="ltr">The interactive prompt? (E.g. idle, or after you type "python" at the terminal) or from the terminal? (as in by typing "python p2.py" at the terminal).</p>
<p dir="ltr">It looks like you're trying to load a file while in the interactive prompt which won't work that way (it will work if you type "import p2"). When you should be using "python p2.py" at the terminal.</p>
<p dir="ltr">- Nick </p>

<br><div class="gmail_quote"><div dir="ltr">On Wed, 2 Sep 2015 19:20  <<a href="mailto:jorge.conrado@cptec.inpe.br" target="_blank">jorge.conrado@cptec.inpe.br</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
<br>
I have a Python version: Python 2.7.8<br>
<br>
I'm runing it on: Fedora release 21<br>
<br>
<br>
Yesterday I a sent a question:<br>
<br>
<br>
I'm starting in the Python scripts. I run this script:<br>
<br>
<br>
import numpy as np<br>
<br>
import netCDF4<br>
<br>
f = netCDF4.Dataset('<a href="http://uwnd.mon.ltm.nc" rel="noreferrer" target="_blank">uwnd.mon.ltm.nc</a>','r')<br>
<br>
<br>
f.variables<br>
<br>
<br>
and I had the message:<br>
<br>
<br>
netcdf4.py<br>
Traceback (most recent call last):<br>
    File "<stdin>", line 1, in <module><br>
NameError: name 'netcdf4' is not defined<br>
<br>
<br>
I had two answers to my question. But I could not understand them. I<br>
don't have expericence with Python. So I downloaded from the Web a code<br>
to calcluate the dew point temperature:<br>
<br>
<br>
import sys<br>
import numpy as np<br>
<br>
# approximation valid for<br>
# 0 degC < T < 60 degC<br>
# 1% < RH < 100%<br>
# 0 degC < Td < 50 degC<br>
<br>
# constants<br>
a = 17.271<br>
b = 237.7 # degC<br>
<br>
# sys.argv[0] is program name<br>
T=float(sys.argv[1])<br>
RH=float(sys.argv[2])<br>
<br>
<br>
def dewpoint_approximation(T,RH):<br>
<br>
     Td = (b * gamma(T,RH)) / (a - gamma(T,RH))<br>
<br>
     return Td<br>
<br>
<br>
def gamma(T,RH):<br>
<br>
     g = (a * T / (b + T)) + np.log(RH/100.0)<br>
<br>
     return g<br>
<br>
<br>
Td = dewpoint_approximation(T,RH)<br>
print 'T, RH',T,RH<br>
print 'Td=',Td<br>
<br>
<br>
Then I run it and I had the message:<br>
<br>
             p2.py<br>
<br>
<br>
Traceback (most recent call last):<br>
   File "<stdin>", line 1, in <module><br>
NameError: name 'p2' is not defined<br>
<br>
<br>
Like the same error that I had for my first run.<br>
<br>
Please, someone can help me. I have a commercial software and I would<br>
like to use Python.<br>
<br>
In advance. Thanks,<br>
<br>
Conrado<br>
<br>
--<br>
<a href="https://mail.python.org/mailman/listinfo/python-list" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-list</a><br>
</blockquote></div><div dir="ltr">-- <br></div><div dir="ltr"> - Nick</div>