mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 16:22:29 +03:00
Fix urllib for Python 3
This commit is contained in:
parent
b5098079d8
commit
83146458a2
|
@ -34,7 +34,7 @@ except ImportError:
|
||||||
from thinc.neural.optimizers import Adam as Optimizer
|
from thinc.neural.optimizers import Adam as Optimizer
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import urllib
|
import urllib.request
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import urllib2 as urllib
|
import urllib2 as urllib
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@ copy_reg = copy_reg
|
||||||
CudaStream = CudaStream
|
CudaStream = CudaStream
|
||||||
cupy = cupy
|
cupy = cupy
|
||||||
copy_array = copy_array
|
copy_array = copy_array
|
||||||
urllib = urllib
|
|
||||||
izip = getattr(itertools, 'izip', zip)
|
izip = getattr(itertools, 'izip', zip)
|
||||||
|
|
||||||
is_windows = sys.platform.startswith('win')
|
is_windows = sys.platform.startswith('win')
|
||||||
|
@ -83,7 +82,7 @@ def url_read(url):
|
||||||
file_ = url_open(url)
|
file_ = url_open(url)
|
||||||
code = file_.getcode()
|
code = file_.getcode()
|
||||||
if code != 200:
|
if code != 200:
|
||||||
raise HTTPError(url, code, "Cannot GET url", [], file_)
|
raise HTTPError(url, code, "Cannot GET url", [], file_)
|
||||||
data = file_.read()
|
data = file_.read()
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user