File "in3sun34.py", line 33, in AttributeError: HTTPConnection

Guillermo Fernandez guillermo.fernandez at epfl.ch
Tue Jun 25 01:19:01 EDT 2002


Hello!

Please, if you answer me, include my e-mail in the answer as I am not
abonned to this mailing list.

I've written a little program to test python (I'm a beginner). Here it
is:

import httplib

conn = httplib.HTTPConnection("www.python.org")
print "CONNECTED"
conn.request("GET", "/index.html
response=conn.getresponse()
answer=response.read()
conn.close()
print answer

When I execute it, I obtain an error:
[112]host-cfernand% python test.py
Traceback (innermost last):
  File "test.py", line 3, in ?
    conn = httplib.HTTPConnection("www.python.org")
AttributeError: HTTPConnection

Line number 3 is:
conn = httplib.HTTPConnection("www.python.org")

I have searched in the internet and in the documentation and I have not
been able to solve it.

On the other hand, this program it works, so it's not a network problem:
import urllib
sock = urllib.urlopen("http://www.python.org/index.html")
htmlSource = sock.read()
sock.close()
print htmlSource

Thank you for your help!

Guille





More information about the Python-list mailing list