From 721397cc219f6fe803652182649d496bf8746fa1 Mon Sep 17 00:00:00 2001 From: Ryan Lucia Date: Sat, 6 Jul 2019 17:34:30 -0400 Subject: [PATCH] Convert dl-test-assets.py to Python 3 (mono/mono#15524) Commit migrated from https://github.com/mono/mono/commit/851dfdb98a2c41427c4f756b2b2f8721ab8e16fc --- src/mono/netcore/dl-test-assets.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mono/netcore/dl-test-assets.py b/src/mono/netcore/dl-test-assets.py index 8d902e8..d422801 100644 --- a/src/mono/netcore/dl-test-assets.py +++ b/src/mono/netcore/dl-test-assets.py @@ -1,11 +1,11 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys import os import subprocess import xml.etree.ElementTree as ET import zipfile -import urllib +import urllib.request, urllib.parse, urllib.error import multiprocessing if len(sys.argv) < 4: @@ -26,13 +26,13 @@ def downloadAsset(elem): return id = elem.attrib ["Id"] filename = os.path.basename(id) - print "Downloading " + filename + print("Downloading " + filename) try: - name, hdrs = urllib.urlretrieve(base_url + "/" + id, outdir + "/" + filename) - except IOError, e: - print ("Download failed for " + id) + name, hdrs = urllib.request.urlretrieve(base_url + "/" + id, outdir + "/" + filename) + except IOError as e: + print("Download failed for " + id) sys.exit (1) - print "Extracting " + filename + print("Extracting " + filename) with zipfile.ZipFile(outdir + "/" + filename) as zf: zf.extractall(outdir + "/extracted/" + filename[:-4]) -- 2.7.4