Are you sitting behind a proxy. If so then you have to set proxy for http<br><br><div class="gmail_quote">On Fri, Dec 5, 2008 at 11:47 AM, svalbard colaco <span dir="ltr"><<a href="mailto:svalbardcolaco@gmail.com">svalbardcolaco@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi all<br><br>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<br>
<br>The following is the code snippet<br>
<br><i>import urllib2<br><br>f = urllib2.urlopen('<a href="http://www.google.com/" target="_blank">http://www.google.com/</a>')<br>print f.read(100)</i><br><br><br>where as the same url <a href="http://www.google.com/" target="_blank">http://www.google.com/</a> works through my browser.<br>

<br>The following is the back trace :<br><br>File "test_url.py", line 3, in ?<br>    f = urllib2.urlopen('<a href="http://www.google.com/" target="_blank">http://www.google.com/</a>')<br>  File "/usr/lib/python2.4/urllib2.py", line 130, in urlopen<br>

    return _opener.open(url, data)<br>  File "/usr/lib/python2.4/urllib2.py", line 358, in open<br>    response = self._open(req, data)<br>  File "/usr/lib/python2.4/urllib2.py", line 376, in _open<br>

    '_open', req)<br>  File "/usr/lib/python2.4/urllib2.py", line 337, in _call_chain<br>    result = func(*args)<br>  File "/usr/lib/python2.4/urllib2.py", line 1021, in http_open<br>    return self.do_open(httplib.HTTPConnection, req)<br>

  File "/usr/lib/python2.4/urllib2.py", line 996, in do_open<br>    raise URLError(err)<br><b>urllib2.URLError: <urlopen error (110, 'Connection timed out</b>')><br><br><br>Any pointers in this regard will be of great help.<br>

<br>Thanking you'll in advance.<br><br>Regards,<br>sv<br><br><br>
<br>--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Regards--<br>Rishi Pathak<br>Pune-Maharastra<br>