From a97b0a6bf5bbf4cb4320b1353c08d7baf977c00b Mon Sep 17 00:00:00 2001 From: linus Date: Mon, 2 Oct 2023 20:24:10 +0200 Subject: [PATCH] Added a try to jsonRead to avoid issues caused by incorrectly formatted databases --- crosspost.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crosspost.py b/crosspost.py index 74e304c..141f434 100644 --- a/crosspost.py +++ b/crosspost.py @@ -415,7 +415,10 @@ def jsonRead(): return database with open(databasePath, 'r') as file: for line in file: - jsonLine = json.loads(line) + try: + jsonLine = json.loads(line) + except: + continue skeet = jsonLine["skeet"] ids = jsonLine["ids"] failed = {"twitter": 0, "mastodon": 0}