Skip to content

Commit

Permalink
Ignore non-present images in .zip (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
notgull authored Mar 8, 2023
1 parent 500664d commit 62048b3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/ontario-web/ontario_web/save_and_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ def load_from_zip(
values = node["values"]
img_path = values["image"]

# Check if the image is in the zip file
if img_path not in zip_file.namelist():
# Just set the image to -1
node["values"]["image"] = -1
continue

# Load the image
image = zip_file.read(img_path)
ext = path.splitext(img_path)[1]
Expand Down

0 comments on commit 62048b3

Please sign in to comment.