From c8ed83ce0938d30a5a26a414cde8025430c4624f Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Tue, 7 Jan 2025 23:03:35 +0900 Subject: [PATCH] fixed: robust loading `comfy.settings.json` https://github.com/comfyanonymous/ComfyUI/issues/6371 --- app/app_settings.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/app_settings.py b/app/app_settings.py index efe87adb..a545df92 100644 --- a/app/app_settings.py +++ b/app/app_settings.py @@ -1,6 +1,7 @@ import os import json from aiohttp import web +import logging class AppSettings(): @@ -11,8 +12,12 @@ class AppSettings(): file = self.user_manager.get_request_user_filepath( request, "comfy.settings.json") if os.path.isfile(file): - with open(file) as f: - return json.load(f) + try: + with open(file) as f: + return json.load(f) + except: + logging.error(f"The user settings file is corrupted: {file}") + return {} else: return {}