From 0b1319442bbd2590c4f0c337db2f2c8d3c0108b5 Mon Sep 17 00:00:00 2001 From: Aaron Freeland Date: Mon, 12 Feb 2018 21:12:11 -0500 Subject: [PATCH] Python 3 renamed the unicode type to str, the old str type has been replaced by bytes https://stackoverflow.com/questions/19877306/nameerror-global-name-unicode-is-not-defined-in-python-3 --- tools/get.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/get.py b/tools/get.py index cbff69d2e09..da4299b04ed 100644 --- a/tools/get.py +++ b/tools/get.py @@ -15,16 +15,19 @@ import tarfile import zipfile import re +_unicode = None if sys.version_info[0] == 3: from urllib.request import urlretrieve + _unicode = str else: # Not Python 3 - today, it is most likely to be Python 2 from urllib import urlretrieve + _unicode = unicode if 'Windows' in platform.system(): import requests -current_dir = os.path.dirname(os.path.realpath(unicode(__file__))) +current_dir = os.path.dirname(os.path.realpath(_unicode(__file__))) dist_dir = current_dir + '/dist/' def sha256sum(filename, blocksize=65536):