[Tutor] possibly a version error

Cranky Frankie cranky.frankie at gmail.com
Thu Dec 22 17:33:01 CET 2011


On the bottom of this web page:

http://developer.yahoo.com/python/python-xml.html

is a program that reads an RSS feed for the weather and then parses
the XML to show weather data by a zip code you input. I'm trying to
run this under Python 3.2 and get this error:

Traceback (most recent call last):
  File "D:\MyDocs\Python\Element Tree for XML\weather.py", line 27, in <module>
    pprint(weather_for_zip(12303))
  File "D:\MyDocs\Python\Element Tree for XML\weather.py", line 10, in
weather_for_zip
    dom = minidom.parse(urllib.urlopen(url))
AttributeError: 'module' object has no attribute 'urlopen'

I'm wondering if this is because this is Python 2.x code? Can someone
who has 2.x try to run this and let me know if that's the problem? Is
there a way to get this to work in Python 3.2?



-- 
Frank L. "Cranky Frankie" Palmeri


More information about the Tutor mailing list