[New-bugs-announce] [issue10836] TypeError during exception handling in urllib.request.urlretrieve

Alexandru Moșoi report at bugs.python.org
Wed Jan 5 19:27:16 CET 2011


New submission from Alexandru Moșoi <alexandru at mosoi.ro>:

If I try to download a inexistent file I get a TypeError which is thrown during exception handling.

>>> import urllib.request
>>> urllib.request.urlretrieve('missing')
Traceback (most recent call last):
  File "/usr/lib/python3.1/urllib/request.py", line 1705, in open_local_file
    stats = os.stat(localname)
OSError: [Errno 2] No such file or directory: 'missing'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.1/urllib/request.py", line 133, in urlretrieve
    return _urlopener.retrieve(url, filename, reporthook, data)
  File "/usr/lib/python3.1/urllib/request.py", line 1507, in retrieve
    fp = self.open_local_file(url1)
  File "/usr/lib/python3.1/urllib/request.py", line 1707, in open_local_file
    raise URLError(e.errno, e.strerror, e.filename)
TypeError: __init__() takes at most 3 positional arguments (4 given)

----------
components: Library (Lib)
messages: 125449
nosy: Alexandru.Moșoi
priority: normal
severity: normal
status: open
title: TypeError during exception handling in urllib.request.urlretrieve
type: behavior
versions: Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10836>
_______________________________________


More information about the New-bugs-announce mailing list