From: Eetu Purontaus Date: Wed, 22 Jan 2025 10:53:35 +0000 (+0200) Subject: Suppress output intent keyerror (#59) X-Git-Tag: 2025.1.0~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dab9e466567b369b6c68af41fbf09c6b6a8ab803;p=thirdparty%2Fpython-drafthorse.git Suppress output intent keyerror (#59) For non-compliant PDFs, output intent structure may be missing. Rather than logging an error, just debug and return. Also use the correct logger.exception() instead of error so the full exception gets logged. --- diff --git a/drafthorse/pdf.py b/drafthorse/pdf.py index 3b07377..a17709a 100644 --- a/drafthorse/pdf.py +++ b/drafthorse/pdf.py @@ -124,8 +124,10 @@ def _get_original_output_intents(original_pdf): "/DestOutputProfile" ].get_object() output_intents.append((ori_output_intent_dict, dest_output_profile_dict)) + except KeyError as ex: + logger.debug("Data missing from PDF: %s", ex) except Exception as ex: - logger.error(ex) + logger.exception(ex) return output_intents