Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use zipfile python library instead of unzip command in arkitscene #1936

Merged
merged 2 commits into from
Apr 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/python/arkitscenes/download_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import math
import os
import subprocess
import zipfile
from pathlib import Path
from typing import Final, List, Optional

Expand Down Expand Up @@ -121,9 +122,9 @@ def download_file(url: str, file_name: str, dst: Path) -> bool:
def unzip_file(file_name: str, dst: Path, keep_zip: bool = True) -> bool:
filepath = os.path.join(dst, file_name)
print(f"Unzipping zip file {filepath}")
command = f"unzip -oq {filepath} -d {dst}"
try:
subprocess.check_call(command, shell=True)
with zipfile.ZipFile(filepath, "r") as zip_ref:
zip_ref.extractall(dst)
except Exception as error:
print(f"Error unzipping {filepath}, error: {error}")
return False
Expand Down