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:]
|
img = img[found:]
|
||||||
size = re.search('(\d+)\s*x\s*(\d+)', img).groups()
|
size = re.search('(\d+)\s*x\s*(\d+)', img).groups()
|
||||||
return (int(size[0]), int(size[1]))
|
return (int(size[0]), int(size[1]))
|
||||||
except ImportError:
|
except (ImportError, FileNotFoundError):
|
||||||
# python-magic is not installed. So Trying to get image size with Gdk.
|
# python-magic is not installed or the file does not exist.
|
||||||
|
# So Trying to get image size with Gdk.
|
||||||
try:
|
try:
|
||||||
img = GdkPixbuf.Pixbuf.new_from_file(source)
|
img = GdkPixbuf.Pixbuf.new_from_file(source)
|
||||||
width = img.get_width()
|
width = img.get_width()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user