socket.error connection refused

Vania vania.cIlli at gmail.com
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
fo=urllib.urlopen("http://www.google.com")

the error I get is:

  File "<stdin>", line 1, in ?
  File "C:\Python24\lib\urllib.py", line 82, in urlopen
    return opener.open(url)
  File "C:\Python24\lib\urllib.py", line 190, in open
    return getattr(self, name)(url)
  File "C:\Python24\lib\urllib.py", line 313, in open_http
    h.endheaders()
  File "C:\Python24\lib\httplib.py", line 798, in endheaders
    self._send_output()
  File "C:\Python24\lib\httplib.py", line 679, in _send_outp
    self.send(msg)
  File "C:\Python24\lib\httplib.py", line 646, in send
    self.connect()
  File "C:\Python24\lib\httplib.py", 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 gmail.com> 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