aboutsummaryrefslogtreecommitdiffstats
path: root/modules/infotext_utils.py
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2024-01-03 22:16:58 +0000
committerAarni Koskela <akx@iki.fi>2024-01-03 22:26:30 +0000
commitd9034b48a526f0a0c3e8f0dbf7c171bf4f0597fd (patch)
treeb01be238a08893afe6c5e5ebb58715c3860a2299 /modules/infotext_utils.py
parente4dcdcc9554d7ff56993f5019eb90fe4ddf1e2e7 (diff)
downloadstable-diffusion-webui-gfx803-d9034b48a526f0a0c3e8f0dbf7c171bf4f0597fd.tar.gz
stable-diffusion-webui-gfx803-d9034b48a526f0a0c3e8f0dbf7c171bf4f0597fd.tar.bz2
stable-diffusion-webui-gfx803-d9034b48a526f0a0c3e8f0dbf7c171bf4f0597fd.zip
Avoid unnecessary `isfile`/`exists` calls
Diffstat (limited to 'modules/infotext_utils.py')
-rw-r--r--modules/infotext_utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/infotext_utils.py b/modules/infotext_utils.py
index e582ee47..6978a0bf 100644
--- a/modules/infotext_utils.py
+++ b/modules/infotext_utils.py
@@ -453,9 +453,11 @@ def connect_paste(button, paste_fields, input_comp, override_settings_component,
def paste_func(prompt):
if not prompt and not shared.cmd_opts.hide_ui_dir_config:
filename = os.path.join(data_path, "params.txt")
- if os.path.exists(filename):
+ try:
with open(filename, "r", encoding="utf8") as file:
prompt = file.read()
+ except OSError:
+ pass
params = parse_generation_parameters(prompt)
script_callbacks.infotext_pasted_callback(prompt, params)