nameerror upon calling function
Arnaud Delobelle
arnodel at googlemail.com
Sat Sep 1 12:46:21 EDT 2007
On Sep 1, 5:05 pm, seancron <seanc... at gmail.com> wrote:
> Hi,
>
> I have a program that makes a call to a function in a different python
> script that I wrote. But, when I call the function I get the
> following error:
>
> NameError: global name 'WSDL' is not defined
>
> I can't figure out why I'm getting this error since WSDL should be
> defined. Here are the two scripts:
>
> weatherpy.py
> from xml.dom import minidom
> from SOAPpy import WSDL
The statement above needs to be in libndfdsoap.py, not here.
> from libndfdsoap import ByDaySOAPRequest
>
> wsdlfile = 'http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/
> ndfdXML.wsdl'
>
> if __name__ == '__main__':
> ByDaySOAPRequest(39.0000, -77.0000, 2004-04-27, 7, '12 hourly')
>
> libndfdsoap.py
> def ByDaySOAPRequest(latitude, longitude, startDate, numDays,
> hrFormat):
> """Sends a SOAP request using the NDFDgenByDay method and stores
> the
> response in a file called weather.xml"""
>
> wsdlfile = 'http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/
> ndfdXML.wsdl'
> server = WSDL.Proxy(wsdlfile)
> response = server.NDFDgenByDay(latitude, longitude, startDate,
> numDays,
> hrFormat)
> xml = open('/weather.xml', 'w')
> xml.write(response)
> xml.close()
> return
>
> Can somebody please show me how to fix this error?
HTH
--
Arnaud
More information about the Python-list
mailing list