From 4e2a98ead4f23001f8c62cbb90b0f74de8edbb6c Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sat, 16 Mar 2019 14:08:58 -0700 Subject: [PATCH] leptonica: fix junkpixt harder --- src/ocrmypdf/leptonica.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ocrmypdf/leptonica.py b/src/ocrmypdf/leptonica.py index 0cc8b643..55de5b9b 100644 --- a/src/ocrmypdf/leptonica.py +++ b/src/ocrmypdf/leptonica.py @@ -614,9 +614,10 @@ class Pix(LeptonicaObject): except (LeptonicaError, ValueError, IndexError): return finally: - with suppress(FileNotFoundError): - os.unlink('junkpixt.png') # leptonica may produce this - os.unlink('junkpixt') + leptonica_junk = ('junkpixt.png', 'junkpixt') + for junk in leptonica_junk: + with suppress(FileNotFoundError): + os.unlink(junk) # leptonica may produce this for n, s in enumerate(sarray): decoded = s.decode()