diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-31 04:38:34 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-31 04:38:34 +0000 |
commit | 5ef669de080814067961f28357256e8fe27544f4 (patch) | |
tree | 655f4582e692f0fc3667b3b668ad365ac3ab92ae /modules/config_states.py | |
parent | c9c8485bc1e8720aba70f029d25cba1c4abf2b5c (diff) | |
parent | e7965a5eb804a51e949df07c66c0b7c61ab7fa7b (diff) | |
download | stable-diffusion-webui-gfx803-5ef669de080814067961f28357256e8fe27544f4.tar.gz stable-diffusion-webui-gfx803-5ef669de080814067961f28357256e8fe27544f4.tar.bz2 stable-diffusion-webui-gfx803-5ef669de080814067961f28357256e8fe27544f4.zip |
Merge branch 'release_candidate'
Diffstat (limited to 'modules/config_states.py')
-rw-r--r-- | modules/config_states.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/modules/config_states.py b/modules/config_states.py index 6f1ab53f..b766aef1 100644 --- a/modules/config_states.py +++ b/modules/config_states.py @@ -8,14 +8,12 @@ import time import tqdm from datetime import datetime -from collections import OrderedDict import git from modules import shared, extensions, errors from modules.paths_internal import script_path, config_states_dir - -all_config_states = OrderedDict() +all_config_states = {} def list_config_states(): @@ -28,10 +26,14 @@ def list_config_states(): for filename in os.listdir(config_states_dir): if filename.endswith(".json"): path = os.path.join(config_states_dir, filename) - with open(path, "r", encoding="utf-8") as f: - j = json.load(f) - j["filepath"] = path - config_states.append(j) + try: + with open(path, "r", encoding="utf-8") as f: + j = json.load(f) + assert "created_at" in j, '"created_at" does not exist' + j["filepath"] = path + config_states.append(j) + except Exception as e: + print(f'[ERROR]: Config states {path}, {e}') config_states = sorted(config_states, key=lambda cs: cs["created_at"], reverse=True) |