Skip to content

Commit

Permalink
Fix file_utils error with untarring files.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmohdyusof committed Jun 16, 2020
1 parent 538f98c commit e2770da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions common/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from six.moves.urllib.request import urlopen
from six.moves.urllib.error import URLError, HTTPError

import wget
import requests
from generic_utils import Progbar

Expand Down Expand Up @@ -88,11 +87,13 @@ def get_file(fname, origin, untar=False,
fnamesplit = fname.split('.tgz')
untar_fpath = os.path.join(datadir, fnamesplit[0])
untar = True
else:
untar_fpath = None

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

download = False
if os.path.exists(fpath) or os.path.exists(untar_fpath):
if os.path.exists(fpath) or (untar_fpath is not None and os.path.exists(untar_fpath)):
# file found; verify integrity if a hash was provided
if md5_hash is not None:
if not validate_file(fpath, md5_hash):
Expand Down Expand Up @@ -126,7 +127,6 @@ def dl_progress(count, block_size, total_size):
try:
try:
urlretrieve(origin, fpath, dl_progress)
#fpath = wget.download(origin)
except URLError as e:
raise Exception(error_msg.format(origin, e.errno, e.reason))
except HTTPError as e:
Expand Down

0 comments on commit e2770da

Please sign in to comment.