[Tutor] Another problem with urllib

Jesse W jessw@loop.com
Fri, 20 Jul 2001 13:59:12 -0700


Remco Gerlich wrote:
> On  0, "Jesse F. W" <jessefw@loop.com> wrote:
> > 	When I attempt to grab a file from the net using urllib.urlopen, it
> > thinks for a second, then gives me a 'Connection refused' socket
> > error.  I am using Python 2.0, Windows 95, and I am connecting to
> > the net with the ISP: loop.com.  I can access the net quite will in
> > other programs.
> 
> The site is refusing connection for some reason; apparently it's down.
> 
> That's not a Python problem.
It's true that 'Connection refused' generaly refers to the site being 
down, which certianly is not a Python problem- But, I get that 
message when I try to access _any_ site, even sites that I am 
looking at in Netscape at the exact same time.  That is why I suspect 
the problem has something to do with Python. ;-)

The error messges I get are below:

>>> urllib.urlopen('http://www.google.com')
Traceback (innermost last):

  File "<pyshell#52>", line 1, in ?
    urllib.urlopen('http://www.google.com')
  File "c:\python20\lib\urllib.py", line 61, in urlopen
    return _urlopener.open(url)
  File "c:\python20\lib\urllib.py", line 166, in open
    return getattr(self, name)(url)
  File "c:\python20\lib\urllib.py", line 273, in open_http
    h.putrequest('GET', selector)
  File "c:\python20\lib\httplib.py", line 425, in putrequest
    self.send(str)
  File "c:\python20\lib\httplib.py", line 367, in send
    self.connect()
  File "c:\python20\lib\httplib.py", line 351, in connect
    self.sock.connect((self.host, self.port))
  File "<string>", line 1, in connect
IOError: [Errno socket error] (10061, 'Connection refused')

	Thank you for your time,
			Jesse Weinstein