Skip to content

Commit a7f3222

Browse files
authored
Merge pull request #67 from ECP-CANDLE/develop
Fix error not detecting untarred local file.
2 parents 22b0e6b + 14d4a0c commit a7f3222

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

common/file_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
from six.moves.urllib.request import urlopen
1010
from six.moves.urllib.error import URLError, HTTPError
1111

12+
import wget
13+
import requests
1214
from generic_utils import Progbar
1315

1416

@@ -90,7 +92,7 @@ def get_file(fname, origin, untar=False,
9092
fpath = os.path.join(datadir, fname)
9193

9294
download = False
93-
if os.path.exists(fpath):
95+
if os.path.exists(fpath) or os.path.exists(untar_fpath):
9496
# file found; verify integrity if a hash was provided
9597
if md5_hash is not None:
9698
if not validate_file(fpath, md5_hash):
@@ -101,10 +103,12 @@ def get_file(fname, origin, untar=False,
101103
download = True
102104

103105
# fix ftp protocol if needed
106+
'''
104107
if origin.startswith('ftp://'):
105108
new_url = origin.replace('ftp://','http://')
106109
origin = new_url
107110
print('Origin = ', origin)
111+
'''
108112

109113
if download:
110114
print('Downloading data from', origin)
@@ -122,6 +126,7 @@ def dl_progress(count, block_size, total_size):
122126
try:
123127
try:
124128
urlretrieve(origin, fpath, dl_progress)
129+
#fpath = wget.download(origin)
125130
except URLError as e:
126131
raise Exception(error_msg.format(origin, e.errno, e.reason))
127132
except HTTPError as e:

0 commit comments

Comments
 (0)