diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2012-10-21 20:30:02 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2012-10-21 20:30:02 (GMT) |
commit | f577686fd3c4a78bb1fe881a872731600ec7c3b6 (patch) | |
tree | bd6b05ccca5a3f6dbd8843f024d09c7141292b0c /Lib/urllib | |
parent | 8a915499f65cb9477483e4af23f93825edaa1d25 (diff) | |
download | cpython-f577686fd3c4a78bb1fe881a872731600ec7c3b6.zip cpython-f577686fd3c4a78bb1fe881a872731600ec7c3b6.tar.gz cpython-f577686fd3c4a78bb1fe881a872731600ec7c3b6.tar.bz2 |
Issue #10836: Fix exception raised when file not found in urlretrieve
Diffstat (limited to 'Lib/urllib')
-rw-r--r-- | Lib/urllib/request.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 250d89e..79a7b40 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1664,7 +1664,7 @@ class URLopener: return getattr(self, name)(url) else: return getattr(self, name)(url, data) - except HTTPError: + except (HTTPError, URLError): raise except socket.error as msg: raise IOError('socket error', msg).with_traceback(sys.exc_info()[2]) @@ -1891,7 +1891,7 @@ class URLopener: try: stats = os.stat(localname) except OSError as e: - raise URLError(e.errno, e.strerror, e.filename) + raise URLError(e.strerror, e.filename) size = stats.st_size modified = email.utils.formatdate(stats.st_mtime, usegmt=True) mtype = mimetypes.guess_type(url)[0] |