Fix urllib.urlopen for python3

Current code is broken on python3. We need to use urllib.request to
use urlopen().

Change-Id: I9f64c22311102c7a67d49b211be91d62b3170a47
This commit is contained in:
Thomas Bechtold 2020-03-17 06:21:22 +01:00
parent 1022a8cca5
commit 50bea70bb5
1 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@ import os
import shutil
import tarfile
import tempfile
import urllib
import urllib.request
import zipfile
@ -29,7 +29,7 @@ def _download_file(url, dest_dir, dest_filename):
"""download a given url to a given destination directory and
destination filenamee"""
filename = os.path.join(dest_dir, dest_filename)
with closing(urllib.urlopen(url)) as response: # nosec
with closing(urllib.request.urlopen(url)) as response: # nosec
with open(filename, 'wb') as f:
while True:
buf = response.read(8192)