From 0d664cfae504edb0fc7e3b5cc92dcfda2441ff59 Mon Sep 17 00:00:00 2001 From: luukas Date: Tue, 14 Jun 2022 00:16:49 +0300 Subject: [PATCH] Remove a useless session.log warning This fixes an error being sent when session.log doesn't exist. This usually occurs when the logs directory is deleted. --- app/classes/shared/helpers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/classes/shared/helpers.py b/app/classes/shared/helpers.py index e99a73c3..bb6ca9fe 100644 --- a/app/classes/shared/helpers.py +++ b/app/classes/shared/helpers.py @@ -1,3 +1,4 @@ +import contextlib import os import re import sys @@ -491,9 +492,10 @@ class Helpers: # del any old session.lock file as this is a new session try: - os.remove(session_log_file) + with contextlib.suppress(FileNotFoundError): + os.remove(session_log_file) except Exception as e: - logger.error(f"Deleting Session.lock failed with error: {e}") + Console.error(f"Deleting Session.lock failed with error: {e}") @staticmethod def get_time_as_string():