Skip to content

Commit

Permalink
Fixed: keeping dest_file_path instead of the local_name for extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolay-r authored Jul 7, 2022
1 parent a03375e commit d67dccb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions download.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ def download_examples_data():

# Extracting tar files ...
for local_name in data.keys():
if not os.path.exists(local_name):
dest_filepath = os.path.join(root_dir, local_name)
if not os.path.exists(dest_filepath):
continue
if not tarfile.is_tarfile(local_name):
if not tarfile.is_tarfile(dest_filepath):
continue
with tarfile.open(local_name) as f:
target = os.path.dirname(local_name)
with tarfile.open(dest_filepath) as f:
target = os.path.dirname(dest_filepath)
f.extractall(path=target)

# Remove .tar file
os.remove(local_name)
os.remove(dest_filepath)


if __name__ == '__main__':
Expand Down

0 comments on commit d67dccb

Please sign in to comment.