diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-07-14 07:12:48 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-07-14 07:12:48 +0000 |
commit | 92a3236161099aca735c3f59f30859750d9e7452 (patch) | |
tree | ffc981e3fdd856dbc389af2e56f0d97d38ecaec1 /modules/hashes.py | |
parent | 9a3f35b028a8026291679c35e1df5b2aea327a1d (diff) | |
parent | 9893d09b4378d14c2a3ef370a5e02b906993ea86 (diff) | |
download | stable-diffusion-webui-gfx803-92a3236161099aca735c3f59f30859750d9e7452.tar.gz stable-diffusion-webui-gfx803-92a3236161099aca735c3f59f30859750d9e7452.tar.bz2 stable-diffusion-webui-gfx803-92a3236161099aca735c3f59f30859750d9e7452.zip |
Merge branch 'dev' into sdxl
Diffstat (limited to 'modules/hashes.py')
-rw-r--r-- | modules/hashes.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/hashes.py b/modules/hashes.py index 8b7ea0ac..ec1187fe 100644 --- a/modules/hashes.py +++ b/modules/hashes.py @@ -5,7 +5,7 @@ import os.path import filelock
from modules import shared
-from modules.paths import data_path
+from modules.paths import data_path, script_path
cache_filename = os.path.join(data_path, "cache.json")
@@ -26,8 +26,13 @@ def cache(subsection): if not os.path.isfile(cache_filename):
cache_data = {}
else:
- with open(cache_filename, "r", encoding="utf8") as file:
- cache_data = json.load(file)
+ try:
+ with open(cache_filename, "r", encoding="utf8") as file:
+ cache_data = json.load(file)
+ except Exception:
+ os.replace(cache_filename, os.path.join(script_path, "tmp", "cache.json"))
+ print('[ERROR] issue occurred while trying to read cache.json, move current cache to tmp/cache.json and create new cache')
+ cache_data = {}
s = cache_data.get(subsection, {})
cache_data[subsection] = s
|