[Tutor] #NameError: global name is not defined
Aaron Elbaz
flamesrock at gmail.com
Thu May 12 10:36:14 CEST 2005
Hi,
I'm having difficulty understanding why the following code doesn't work:
getfr.py
#import pymetar
#
#class wReport:
# def __init__(self,metarcode="CYYC"): #weather for calgary INTL
# self.METARCODE=metarcode
# rf=pymetar.ReportFetcher(self.METARCODE)
# rep=rf.FetchReport()
# pr=rp.ParseReport(rep)
# def getRep()
# return pr.getFullReport
#>>> import getfr
#>>> w = getfr.wReport()
#Traceback (most recent call last):
# File "<stdin>", line 1, in ?
# File "getfr.py", line 8, in __init__
# pr=rp.ParseReport(rep)
#NameError: global name 'rp' is not defined
The goal of this simple script is to get a full weather report from
pymetar in only two lines of code (for my own amusement.)
I've tried using self.rp (.rf etc..) to no avail. Any ideas what I'm
doing wrong?
-thanks in advance
More information about the Tutor
mailing list