CONNECTION TIMED OUT ERROR using urllib2

svalbard colaco svalbardcolaco at gmail.com
Fri Dec 5 01:17:45 EST 2008


Hi all

I have written a small code snippet to open a URL using urllib2 to open a
web page , my python version is 2.4 but i get an urlopen error called
connection timed out

The following is the code snippet

*import urllib2

f = urllib2.urlopen('http://www.google.com/')
print f.read(100)*


where as the same url http://www.google.com/ works through my browser.

The following is the back trace :

File "test_url.py", line 3, in ?
    f = urllib2.urlopen('http://www.google.com/')
  File "/usr/lib/python2.4/urllib2.py", line 130, in urlopen
    return _opener.open(url, data)
  File "/usr/lib/python2.4/urllib2.py", line 358, in open
    response = self._open(req, data)
  File "/usr/lib/python2.4/urllib2.py", line 376, in _open
    '_open', req)
  File "/usr/lib/python2.4/urllib2.py", line 337, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.4/urllib2.py", line 1021, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.4/urllib2.py", line 996, in do_open
    raise URLError(err)
*urllib2.URLError: <urlopen error (110, 'Connection timed out*')>


Any pointers in this regard will be of great help.

Thanking you'll in advance.

Regards,
sv
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081205/48efa337/attachment-0001.html>


More information about the Python-list mailing list