diff --git a/packages/helpermodules/logger.py b/packages/helpermodules/logger.py index e164861394..dff683a355 100644 --- a/packages/helpermodules/logger.py +++ b/packages/helpermodules/logger.py @@ -177,6 +177,10 @@ def mb_to_bytes(megabytes: int) -> int: logging.getLogger("uModbus").setLevel(logging.WARNING) logging.getLogger("websockets").setLevel(logging.WARNING) + thread_errors_path = Path(Path(__file__).resolve().parents[2]/"ramdisk"/"thread_errors.log") + with thread_errors_path.open("w") as f: + f.write("") + def threading_excepthook(args): with open(RAMDISK_PATH+"thread_errors.log", "a") as f: f.write("Uncaught exception in thread:\n") diff --git a/packages/main.py b/packages/main.py index c399298b65..59090a0413 100755 --- a/packages/main.py +++ b/packages/main.py @@ -146,7 +146,9 @@ def handler5Min(self): def handler_midnight(self): try: save_log(LogType.MONTHLY) - Path(Path(__file__).resolve().parents[1]/"ramdisk"/"thread_errors.log").unlink(missing_ok=True) + thread_errors_path = Path(Path(__file__).resolve().parents[1]/"ramdisk"/"thread_errors.log") + with thread_errors_path.open("w") as f: + f.write("") except KeyboardInterrupt: log.critical("Ausführung durch exit_after gestoppt: "+traceback.format_exc()) except Exception: