Simple example that won't work!

Tom Good Tom_Good1 at excite.com
Tue Jun 19 15:37:16 EDT 2001


Jay Parlar <jparlar at home.com> wrote in message news:<mailman.992962109.31012.python-list at python.org>...
> 
> def download(url = 'http://www.opera.com:3600',process = firstlast):
>     print url
>     retval= urlretrieve(url)[0]

Well, for me that URL is a problem.  Here is my test:

PythonWin 2.1 (#15, Jun 15 2001, 14:13:47) [MSC 32 bit (Intel)] on
win32.
Portions Copyright 1994-2001 Mark Hammond (MarkH at ActiveState.com) -
see 'Help/About PythonWin' for further copyright information.
>>> from urllib import urlretrieve
>>> x = urlretrieve('http://www.opera.com:3600')
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "c:\python21\lib\urllib.py", line 78, in urlretrieve
    return _urlopener.retrieve(url, filename, reporthook, data)
  File "c:\python21\lib\urllib.py", line 208, in retrieve
    fp = self.open(url, data)
  File "c:\python21\lib\urllib.py", line 176, in open
    return getattr(self, name)(url)
  File "c:\python21\lib\urllib.py", line 283, in open_http
    h.putrequest('GET', selector)
  File "c:\python21\lib\httplib.py", line 432, in putrequest
    self.send(str)
  File "c:\python21\lib\httplib.py", line 374, in send
    self.connect()
  File "c:\python21\lib\httplib.py", line 358, in connect
    self.sock.connect((self.host, self.port))
  File "<string>", line 1, in connect
IOError: [Errno socket error] (10061, 'Connection refused')
>>>



More information about the Python-list mailing list