From 0186e2551eb775ff19f7fda52025758f6f73e36e Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Thu, 12 Apr 2018 11:17:54 +1000 Subject: [PATCH] Fix error handling for pdfs whose info cannot be read --- scripts/pdf_unlock.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/pdf_unlock.py b/scripts/pdf_unlock.py index 472a51c..707716d 100644 --- a/scripts/pdf_unlock.py +++ b/scripts/pdf_unlock.py @@ -116,7 +116,11 @@ def pdf_unlock(pdf_file, overwrite=False): return # Skip file if it is not encrypted - if not isencrypted(pdf_file): + try: + if not isencrypted(pdf_file): + return + # SKip file if pdf info cannot be read + except AttributeError: return # Get name of Ghostscript executable