From 57e03cdd244eee4e33ccab7554b3594563a3d0cd Mon Sep 17 00:00:00 2001 From: brkirch Date: Wed, 12 Oct 2022 00:54:24 -0400 Subject: [PATCH] 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. --- modules/ui.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/ui.py b/modules/ui.py index 00bf09ae3bd..cd67b84b353 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -131,6 +131,8 @@ def __init__(self, d=None): 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)