image processing error handling

This commit is contained in:
simon 2019-09-06 22:39:31 -04:00
parent 5441ea0809
commit 589e578473

View File

@ -47,9 +47,6 @@ def image_meta(url, url_idx, web):
try:
f = BytesIO(buf)
im = Image.open(f)
except Exception as e:
logger.warning("exception during image open: " + str(e))
return None
meta = {
"url": url_idx,
@ -64,6 +61,9 @@ def image_meta(url, url_idx, web):
"ahash": b64hash(imagehash.average_hash(im, hash_size=12), 18),
"whash": b64hash(imagehash.whash(im, hash_size=8), 8),
}
except Exception as e:
logger.warning("exception during image post processing: " + str(e))
return None
del im, r, buf