From 174448a2b008177826334e9732fdaef2ae037734 Mon Sep 17 00:00:00 2001 From: nanos Date: Thu, 3 Aug 2023 10:54:14 +0100 Subject: [PATCH] fix bug in writing file to disk --- find_posts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/find_posts.py b/find_posts.py index fa22818..ea9b695 100644 --- a/find_posts.py +++ b/find_posts.py @@ -1089,7 +1089,7 @@ class OrderedSet: return len(self._dict) def toJSON(self): - return json.dump(self._dict, f, default=str) + return json.dumps(self._dict,default=str) def get_server_from_host_meta(server): url = f'https://{server}/.well-known/host-meta' @@ -1468,7 +1468,7 @@ if __name__ == "__main__": json.dump(dict(list(replied_toot_server_ids.items())[-10000:]), f) with open(RECENTLY_CHECKED_USERS_FILE, "w", encoding="utf-8") as f: - recently_checked_users.toJSON() + f.write(recently_checked_users.toJSON()) with open(SEEN_HOSTS_FILE, "w", encoding="utf-8") as f: f.write(seen_hosts.toJSON())