9
9
from six .moves .urllib .request import urlopen
10
10
from six .moves .urllib .error import URLError , HTTPError
11
11
12
+ import wget
13
+ import requests
12
14
from generic_utils import Progbar
13
15
14
16
@@ -90,7 +92,7 @@ def get_file(fname, origin, untar=False,
90
92
fpath = os .path .join (datadir , fname )
91
93
92
94
download = False
93
- if os .path .exists (fpath ):
95
+ if os .path .exists (fpath ) or os . path . exists ( untar_fpath ) :
94
96
# file found; verify integrity if a hash was provided
95
97
if md5_hash is not None :
96
98
if not validate_file (fpath , md5_hash ):
@@ -101,10 +103,12 @@ def get_file(fname, origin, untar=False,
101
103
download = True
102
104
103
105
# fix ftp protocol if needed
106
+ '''
104
107
if origin.startswith('ftp://'):
105
108
new_url = origin.replace('ftp://','http://')
106
109
origin = new_url
107
110
print('Origin = ', origin)
111
+ '''
108
112
109
113
if download :
110
114
print ('Downloading data from' , origin )
@@ -122,6 +126,7 @@ def dl_progress(count, block_size, total_size):
122
126
try :
123
127
try :
124
128
urlretrieve (origin , fpath , dl_progress )
129
+ #fpath = wget.download(origin)
125
130
except URLError as e :
126
131
raise Exception (error_msg .format (origin , e .errno , e .reason ))
127
132
except HTTPError as e :
0 commit comments