fix: Handle JSON decode errors when loading results

This commit is contained in:
Paul Gauthier (aider) 2024-12-17 20:34:21 -08:00
parent 914ce0b94d
commit 31f8c7d9cb

View file

@ -410,10 +410,13 @@ def show_diffs(dirnames):
def load_results(dirname):
dirname = Path(dirname)
# handle JSON decode errors, just skip those files. ai!
all_results = [
json.loads(fname.read_text())
for fname in dirname.glob("*/exercises/practice/*/.aider.results.json")
all_results = []
for fname in dirname.glob("*/exercises/practice/*/.aider.results.json"):
try:
results = json.loads(fname.read_text())
all_results.append(results)
except json.JSONDecodeError:
continue
]
return all_results