From f948ee11bed7c6725c390e1f1bdfe283ee98938f Mon Sep 17 00:00:00 2001 From: David Martin Date: Mon, 8 Oct 2018 19:12:11 +1100 Subject: [PATCH] Let unpaper overwrite temporary files. I'm not sure what the circumstances are, but it looks like unpaper can attempt to write a temporary file that already exists [0]. This then fails the consumption. As per daedadu's comment simply letting unpaper overwrite files fixes this. [0] unpaper: error: output file '/tmp/paperless/paperless-pjkrcr4l/convert-0000.unpaper.pnm' already present. See https://web.archive.org/web/20181008081515/https://github.com/danielquinn/paperless/issues/406#issue-360651630 --- src/paperless_tesseract/parsers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/paperless_tesseract/parsers.py b/src/paperless_tesseract/parsers.py index dc5dbd637..0139738be 100644 --- a/src/paperless_tesseract/parsers.py +++ b/src/paperless_tesseract/parsers.py @@ -218,7 +218,8 @@ def run_convert(*args): def run_unpaper(args): unpaper, pnm = args - command_args = unpaper, pnm, pnm.replace(".pnm", ".unpaper.pnm") + command_args = (unpaper, "--overwrite", pnm, + pnm.replace(".pnm", ".unpaper.pnm")) if not subprocess.Popen(command_args).wait() == 0: raise ParseError("Unpaper failed at {}".format(command_args))