Add check for no image
This commit is contained in:
parent
3a0cb54fa0
commit
660db24dec
1 changed files with 8 additions and 6 deletions
|
@ -66,6 +66,7 @@ class image_classifier:
|
||||||
move it to the folder of the day'''
|
move it to the folder of the day'''
|
||||||
self._log.debug(f"Processing file '{file}'...")
|
self._log.debug(f"Processing file '{file}'...")
|
||||||
people = self.find_faces(file)
|
people = self.find_faces(file)
|
||||||
|
if people:
|
||||||
with open(file, 'rb') as image_file:
|
with open(file, 'rb') as image_file:
|
||||||
exif_info = exif.Image(image_file)
|
exif_info = exif.Image(image_file)
|
||||||
if exif_info.has_exif:
|
if exif_info.has_exif:
|
||||||
|
@ -99,6 +100,7 @@ class image_classifier:
|
||||||
names.append(known_person['name'])
|
names.append(known_person['name'])
|
||||||
except PIL.UnidentifiedImageError as error:
|
except PIL.UnidentifiedImageError as error:
|
||||||
self._log.debug(f"File '{file}' don't seem to be an image.")
|
self._log.debug(f"File '{file}' don't seem to be an image.")
|
||||||
|
return False
|
||||||
return names
|
return names
|
||||||
|
|
||||||
def _init_log(self):
|
def _init_log(self):
|
||||||
|
|
Loading…
Reference in a new issue