From 83146458a27bda596283bf80ecf5af4b8e621951 Mon Sep 17 00:00:00 2001 From: ines Date: Thu, 29 Mar 2018 00:19:33 +0200 Subject: [PATCH] Fix urllib for Python 3 --- spacy/compat.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spacy/compat.py b/spacy/compat.py index d6260a850..c5ddae0ce 100644 --- a/spacy/compat.py +++ b/spacy/compat.py @@ -34,7 +34,7 @@ except ImportError: from thinc.neural.optimizers import Adam as Optimizer try: - import urllib + import urllib.request except ImportError: import urllib2 as urllib @@ -48,7 +48,6 @@ copy_reg = copy_reg CudaStream = CudaStream cupy = cupy copy_array = copy_array -urllib = urllib izip = getattr(itertools, 'izip', zip) is_windows = sys.platform.startswith('win') @@ -83,7 +82,7 @@ def url_read(url): file_ = url_open(url) code = file_.getcode() if code != 200: - raise HTTPError(url, code, "Cannot GET url", [], file_) + raise HTTPError(url, code, "Cannot GET url", [], file_) data = file_.read() return data