From 4cd968daa6759057d2c58b6a966fc4d343545add Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Tue, 9 Feb 2021 11:21:38 +0100 Subject: [PATCH] image magic exception if file not found --- gramps/gen/utils/image.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gramps/gen/utils/image.py b/gramps/gen/utils/image.py index 7a953f580..202d628f0 100644 --- a/gramps/gen/utils/image.py +++ b/gramps/gen/utils/image.py @@ -179,8 +179,9 @@ def image_size(source): img = img[found:] size = re.search('(\d+)\s*x\s*(\d+)', img).groups() return (int(size[0]), int(size[1])) - except ImportError: - # python-magic is not installed. So Trying to get image size with Gdk. + except (ImportError, FileNotFoundError): + # python-magic is not installed or the file does not exist. + # So Trying to get image size with Gdk. try: img = GdkPixbuf.Pixbuf.new_from_file(source) width = img.get_width()