socket.error connection refused

robert no-spam at no-spam-no-spam.invalid
Fri Nov 24 05:07:56 EST 2006


Vania wrote:
> Hi, I'm not sure this is the proper forum but I try nevertheless.
> The problem I'am facing is that the socket library always fail to
> connect to an URL. The net effect is that I can not use setuptools.
> I'm using Python2.4 on a windows XPPRO Sp2 machine.
> The firewall is disabled.
> There is no NLTM proxy.
> I connect to the internet through a NAT server (and it works).
> Other than with easy_install I tried to connect to a number of external
> urls
> (all of them running) and even to localhost,
> directly in script using urllib
> and the error is always the same errno:  10061 connection refused.
> Any ideas?


urllib.urlopen can pick up an invalid proxy setting from environ or IE-settings.

routers/NAT servers sometimes need a 2nd tick - all browsers try it 2..4 times before displaying "no connection" - this is (unfortunately) not the default behavior of the "browser" urllib.

if bare

>>> import httplib
>>> h=httplib.HTTPConnection('www.google.com')
>>> h.connect()
>>> h.request('GET','/')
>>> h.getresponse().read()
'<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">\n<TITLE>302 Moved</TITLE></HEAD><BODY>\n<H1>302 Moved</H1>\nThe document has moved\n<A HREF="http://www.google.de/">here</A>.\r\n</BODY></HTML>\r\n'
>>> 

fails on multiple trials, then you have a very strange network setup. maybe multiple/confusing NIC's ...


Robert



More information about the Python-list mailing list