AttributeError: 'module' object has no attribute 'urlopen'

dont bother dontbotherworld at yahoo.com
Mon Feb 23 02:58:45 EST 2004


Hey,
I am trying to run the following example from
diveintopython

import urllib
sock = urllib.urlopen("http://diveintopython.org/")
htmlSource = sock.read()
sock.close()
print htmlSource

I have Python 2.3.3 but when i run the above code I
get the following error:

raceback (most recent call last):
  File "urllib.py", line 1, in ?
    import urllib
  File
"/home/shalen/programming/python/tutorials/py/urllib.py",
line 2, in ?
    sock =
urllib.urlopen("http://diveintopython.org/")
AttributeError: 'module' object has no attribute
'urlopen'

Anyone knows how to fix this and why I am getting this
error?

Thanks
Dont



~
~
~
~


__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools




More information about the Python-list mailing list