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.
This commit is contained in:
brkirch 2022-10-12 00:54:24 -04:00 committed by AUTOMATIC1111
parent 8aead63f1a
commit 57e03cdd24
1 changed files with 2 additions and 0 deletions

View File

@ -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)