socket.error connection refused

Vania vania.cIlli at
Thu Nov 23 13:32:45 CET 2006

Hi, the reason I mentioned the socket is because that is
where the error eventually occurs.

the code I tried manually (with different urls including a local one)
is the following:

import urllib

the error I get is:

  File "<stdin>", line 1, in ?
  File "C:\Python24\lib\", line 82, in urlopen
  File "C:\Python24\lib\", line 190, in open
    return getattr(self, name)(url)
  File "C:\Python24\lib\", line 313, in open_http
  File "C:\Python24\lib\", line 798, in endheaders
  File "C:\Python24\lib\", line 679, in _send_outp
  File "C:\Python24\lib\", line 646, in send
  File "C:\Python24\lib\", line 630, in connect
    raise socket.error, msg
IOError: [Errno socket error] (10061, 'Connection refused')

Tim Williams ha scritto:

> On 23 Nov 2006 04:09:18 -0800, Vania <vania.cIlli at> 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?
> A socket can't connect to a URL, a URL is an absolute location of an
> internet resource, eg hostname + (virtual) location on a server + page
> name.  A socket can connect to an IP address or hostname - which is
> the first part of the URL after the "http://"  (or ftp:// etc)
> You need to post a code snippet and the errors you are getting.

More information about the Python-list mailing list