Skip to content

Commit e2770da

Browse files
committed
Fix file_utils error with untarring files.
1 parent 538f98c commit e2770da

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

common/file_utils.py

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

12-
import wget
1312
import requests
1413
from generic_utils import Progbar
1514

@@ -88,11 +87,13 @@ def get_file(fname, origin, untar=False,
8887
fnamesplit = fname.split('.tgz')
8988
untar_fpath = os.path.join(datadir, fnamesplit[0])
9089
untar = True
90+
else:
91+
untar_fpath = None
9192

9293
fpath = os.path.join(datadir, fname)
9394

9495
download = False
95-
if os.path.exists(fpath) or os.path.exists(untar_fpath):
96+
if os.path.exists(fpath) or (untar_fpath is not None and os.path.exists(untar_fpath)):
9697
# file found; verify integrity if a hash was provided
9798
if md5_hash is not None:
9899
if not validate_file(fpath, md5_hash):
@@ -126,7 +127,6 @@ def dl_progress(count, block_size, total_size):
126127
try:
127128
try:
128129
urlretrieve(origin, fpath, dl_progress)
129-
#fpath = wget.download(origin)
130130
except URLError as e:
131131
raise Exception(error_msg.format(origin, e.errno, e.reason))
132132
except HTTPError as e:

0 commit comments

Comments
 (0)