Skip to content

Commit a7ddf49

Browse files
WumpfnikolausWest
andauthored
Use zipfile python library instead of unzip command in arkitscene (#1936)
* Use zipfile python library instead of `unzip` command in arkitscene Windows doesn't have unzip! * Nit: import sort order --------- Co-authored-by: Nikolaus West <[email protected]>
1 parent b310010 commit a7ddf49

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/python/arkitscenes/download_dataset.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import math
44
import os
55
import subprocess
6+
import zipfile
67
from pathlib import Path
78
from typing import Final, List, Optional
89

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

0 commit comments

Comments
 (0)