From d816c9d3028da96c681fc31abe6649ec3ca85a1d Mon Sep 17 00:00:00 2001 From: Simon Zeyer Date: Wed, 16 Oct 2024 18:23:22 +0000 Subject: [PATCH] fix removed file on print hook --- app/hooks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/hooks.py b/app/hooks.py index 4d0cf3b..5bf5f4f 100644 --- a/app/hooks.py +++ b/app/hooks.py @@ -143,8 +143,8 @@ def cups_print(parsed_body: dict, body: str): if 'ALARMDEPESCHE' in parsed_body: for i in range(0, print_num): conn.printFile (printer, fname, "Alarmfax", {}) - os.remove(fname) except Exception as e: + logging.error("cups_print", e) + finally: if os.path.exists(fname): - os.remove(fname) - logging.error("cups_print", e) \ No newline at end of file + os.remove(fname) \ No newline at end of file