Commit 288febc6 authored by André Melo's avatar André Melo
Browse files

Catch PDFPageCountErrors

parent c5e7f475
Pipeline #78329 failed with stage
in 1 minute and 3 seconds
......@@ -167,10 +167,13 @@ def extract_images_tar(tar):
image.thumbnail((200, 200), PIL.Image.NEAREST)
yield image
elif suffix == "pdf":
image = pdf2image.convert_from_bytes(
tar.extractfile(member).read(), size=200, fmt="ppm"
)[0]
yield convert_to_rgb(image)
try:
image = pdf2image.convert_from_bytes(
tar.extractfile(member).read(), size=200, fmt="ppm"
)[0]
yield convert_to_rgb(image)
except pdf2image.exceptions.PDFPageCountError:
logging.warning(f'Broken pdf image {member.name}')
elif suffix in IGNORE_EXTS:
pass
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment