summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-05-05 17:48:46 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-05-05 17:48:46 +0200
commitf565b1a847ac0874a06cddede551fb01aa031036 (patch)
tree8ec4e9ea241f8f707a4de70a6f6fa4c439644665
parent1a230431eb2a43ecd39f81be6758c64aee352c3d (diff)
gracefully handle image loader and EXIF failures
-rwxr-xr-xbin/pyggle14
1 files changed, 12 insertions, 2 deletions
diff --git a/bin/pyggle b/bin/pyggle
index 8f53b3c..64315dc 100755
--- a/bin/pyggle
+++ b/bin/pyggle
@@ -254,7 +254,11 @@ class Thumbnail:
self.group_key = None
with open(filename, "rb") as f:
- self.exif_tag = exifread.process_file(f)
+ try:
+ self.exif_tag = exifread.process_file(f)
+ except Exception as e:
+ print(f"Cannot read EXIF data fom '{filename}': {e}", file=sys.stderr)
+ self.exif_tag = dict()
self.exiftool = dict()
try:
@@ -668,9 +672,15 @@ if __name__ == "__main__":
# perhaps raise a warning?
continue
+ try:
+ im_copy = im.copy()
+ except Exception as e:
+ print(f"Cannot load image '{filename}': {e}", file=sys.stderr)
+ continue
+
thumbnail = Thumbnail(
filename,
- im.copy(),
+ im_copy,
size=args.size,
with_gps=args.with_nominatim,
group_key_template=args.group,