aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrkirch <brkirch@users.noreply.github.com>2022-10-12 04:54:24 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2022-10-12 06:55:56 +0000
commit57e03cdd244eee4e33ccab7554b3594563a3d0cd (patch)
treed261a1db75c7e86c610d5f83a391baf13a6370a4
parent8aead63f1ac9fec0e5198bd626ec2c5bcbeff4d8 (diff)
downloadstable-diffusion-webui-gfx803-57e03cdd244eee4e33ccab7554b3594563a3d0cd.tar.gz
stable-diffusion-webui-gfx803-57e03cdd244eee4e33ccab7554b3594563a3d0cd.tar.bz2
stable-diffusion-webui-gfx803-57e03cdd244eee4e33ccab7554b3594563a3d0cd.zip
Ensure the directory exists before saving to it
The directory for the images saved with the Save button may still not exist, so it needs to be created prior to opening the log.csv file.
-rw-r--r--modules/ui.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/ui.py b/modules/ui.py
index 00bf09ae..cd67b84b 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -131,6 +131,8 @@ def save_files(js_data, images, do_make_zip, index):
images = [images[index]]
start_index = index
+ os.makedirs(opts.outdir_save, exist_ok=True)
+
with open(os.path.join(opts.outdir_save, "log.csv"), "a", encoding="utf8", newline='') as file:
at_start = file.tell() == 0
writer = csv.writer(file)