Commit 268347eb authored by Mark Daoust's avatar Mark Daoust
Browse files

use six for urlopen

parent e1a1328c
...@@ -21,10 +21,7 @@ import tensorflow as tf ...@@ -21,10 +21,7 @@ import tensorflow as tf
import os import os
import sys import sys
if sys.version_info < (3, 0, 0): import six.moves.urllib.request as request
from urllib import urlopen
else:
from urllib.request import urlopen
tf.logging.set_verbosity(tf.logging.INFO) tf.logging.set_verbosity(tf.logging.INFO)
...@@ -47,7 +44,7 @@ def downloadDataset(url, file): ...@@ -47,7 +44,7 @@ def downloadDataset(url, file):
if not os.path.exists(PATH_DATASET): if not os.path.exists(PATH_DATASET):
os.makedirs(PATH_DATASET) os.makedirs(PATH_DATASET)
if not os.path.exists(file): if not os.path.exists(file):
data = urlopen(url).read() data = request.urlopen(url).read()
with open(file, "wb") as f: with open(file, "wb") as f:
f.write(data) f.write(data)
f.close() f.close()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment