From f2a76da7e260530a798fafe7d6132d63ca6e90b3 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Fri, 25 Aug 2023 21:49:05 +0300 Subject: [PATCH] fix error in test suite when full reset has not been done --- core/views/statistics.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/views/statistics.py b/core/views/statistics.py index d18ca57..ebe70dd 100644 --- a/core/views/statistics.py +++ b/core/views/statistics.py @@ -82,11 +82,16 @@ def therionissues(request): newlog = [] if Path(logpath).is_file: - with open(logpath, "r") as f: - therionlog = f.readlines() - print(f"{logpath} has {len(therionlog)} entries") + try: + with open(logpath, "r") as f: + therionlog = f.readlines() + print(f"{logpath} has {len(therionlog)} entries") + except: + msg = f"{logpath} EXCEPTION opening or reading therion logfile. Run a full reset." + print(msg) + return render(request, "therionreport.html", {"therionlog": newlog}) else: - print(f"{logpath} NOT FOUND {len(therionlog)}") + print(f"{logpath} NOT FOUND: {len(therionlog)} entries") for line in therionlog: line = line.replace("! Un-parsed image filename:", "")