diff options
Diffstat (limited to 'python/servo/util.py')
-rw-r--r-- | python/servo/util.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/python/servo/util.py b/python/servo/util.py index 818240d39e6..f51b1f12252 100644 --- a/python/servo/util.py +++ b/python/servo/util.py @@ -20,7 +20,7 @@ import StringIO import sys import time import zipfile -import urllib2 +import six.moves.urllib as urllib try: @@ -101,10 +101,10 @@ def download(desc, src, writer, start_byte=0): dumb = (os.environ.get("TERM") == "dumb") or (not sys.stdout.isatty()) try: - req = urllib2.Request(src) + req = urllib.request.Request(src) if start_byte: - req = urllib2.Request(src, headers={'Range': 'bytes={}-'.format(start_byte)}) - resp = urllib2.urlopen(req, **get_urlopen_kwargs()) + req = urllib.request.Request(src, headers={'Range': 'bytes={}-'.format(start_byte)}) + resp = urllib.request.urlopen(req, **get_urlopen_kwargs()) fsize = None if resp.info().getheader('Content-Length'): @@ -136,13 +136,13 @@ def download(desc, src, writer, start_byte=0): if not dumb: print() - except urllib2.HTTPError, e: + except urllib.error.HTTPError, e: print("Download failed ({}): {} - {}".format(e.code, e.reason, src)) if e.code == 403: print("No Rust compiler binary available for this platform. " "Please see https://github.com/servo/servo/#prerequisites") sys.exit(1) - except urllib2.URLError, e: + except urllib.error.URLError, e: print("Error downloading {}: {}. The failing URL was: {}".format(desc, e.reason, src)) sys.exit(1) except socket_error, e: |