Are you sitting behind a proxy. If so then you have to set proxy for http On Fri, Dec 5, 2008 at 11:47 AM, svalbard colaco <[EMAIL PROTECTED]>wrote:
> 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 > > > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- Regards-- Rishi Pathak Pune-Maharastra
-- http://mail.python.org/mailman/listinfo/python-list