Skip to content

Commit

Permalink
fixed: robust loading comfy.settings.json (#6383)
Browse files Browse the repository at this point in the history
  • Loading branch information
ltdrdata authored Jan 7, 2025
1 parent 4209edf commit c515bdf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/app_settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import json
from aiohttp import web
import logging


class AppSettings():
Expand All @@ -11,8 +12,12 @@ def get_settings(self, request):
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 {}

Expand Down

0 comments on commit c515bdf

Please sign in to comment.