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