diff options
author | Jeremy Katz <katzj@redhat.com> | 2003-01-02 07:18:41 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2003-01-02 07:18:41 +0000 |
commit | 5ea474aad08b61d2ac8d5648d825e8327d6c8582 (patch) | |
tree | b251a3ada59c8bdf2427081fbcb4ee521dc417d7 | |
parent | 7deb135d80afb1faee757b8ad01bf3eee799c708 (diff) | |
download | anaconda-5ea474aad08b61d2ac8d5648d825e8327d6c8582.tar.gz anaconda-5ea474aad08b61d2ac8d5648d825e8327d6c8582.tar.xz anaconda-5ea474aad08b61d2ac8d5648d825e8327d6c8582.zip |
fixup urllib2 usage a little bit to handle HTTP errors nicely
-rw-r--r-- | urlinstall.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/urlinstall.py b/urlinstall.py index 6ccafdb79..d2516f6fd 100644 --- a/urlinstall.py +++ b/urlinstall.py @@ -37,7 +37,10 @@ DISCNUM = 1000002 def urlretrieve(location, file): """Downloads from location and saves to file.""" - url = urllib2.urlopen(location) + try: + url = urllib2.urlopen(location) + except urllib2.HTTPError, e: + raise IOError(e.code, e.msg) f = open(file, 'w+') f.write(url.read()) f.close() @@ -74,8 +77,8 @@ class UrlInstallMethod(InstallMethod): try: urlretrieve(fullPath, file) except IOError, (errnum, msg): - log("IOError %s occurred getting %s: %s", - errnum, fullPath, str(msg)) + log("IOError %s occurred getting %s: %s" + %(errnum, fullPath, str(msg))) time.sleep(5) else: break |