From caa7463b7010645a1c05c8b568185cee0a721105 Mon Sep 17 00:00:00 2001 From: Etzelia Date: Mon, 7 Jan 2019 05:18:37 +0100 Subject: [PATCH] Protect stats from corrupted files --- external/stats.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/external/stats.py b/external/stats.py index dad52c6..b8fc2af 100644 --- a/external/stats.py +++ b/external/stats.py @@ -14,7 +14,10 @@ def get_stats(): stats = {} for filename in os.listdir(stats_dir): with open(stats_dir + "/" + filename) as json_file: - raw = json.load(json_file)['stats'] + try: + raw = json.load(json_file)['stats'] + except: + continue clean = {} raw_copy = copy.deepcopy(raw) for ra in raw_copy: