Can not get urllib.urlopen to work

Pater Maximus emayo at home.com
Wed Oct 27 14:40:58 EDT 2004


I am trying to implement the recipe listed at
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/211886

However, I can not get to first base. When I try to run

import urllib
fo=urllib.urlopen("http://www.dictionary.com/")
page = fo.read()

I get:

Traceback (most recent call last):
  File "C:/Program Files/Python/Lib/idlelib/testurl", line 2, in -toplevel-
    fo=urllib.urlopen("http://www.dictionary.com/")
  File "C:\PROGRA~1\PYTHON\lib\urllib.py", line 76, in urlopen
    return opener.open(url)
  File "C:\PROGRA~1\PYTHON\lib\urllib.py", line 181, in open
    return getattr(self, name)(url)
  File "C:\PROGRA~1\PYTHON\lib\urllib.py", line 297, in open_http
    h.endheaders()
  File "C:\PROGRA~1\PYTHON\lib\httplib.py", line 712, in endheaders
    self._send_output()
  File "C:\PROGRA~1\PYTHON\lib\httplib.py", line 597, in _send_output
    self.send(msg)
  File "C:\PROGRA~1\PYTHON\lib\httplib.py", line 564, in send
    self.connect()
  File "C:\PROGRA~1\PYTHON\lib\httplib.py", line 548, in connect
    raise socket.error, msg
IOError: [Errno socket error] (10061, 'Connection refused')





More information about the Python-list mailing list