image magic exception if file not found
This commit is contained in:
parent
0e738c7711
commit
4cd968daa6
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user