diff options
author | timntorres <timothynarcisotorres@gmail.com> | 2022-10-19 19:22:23 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2022-10-21 06:55:00 +0000 |
commit | 6014fb8afbe05c8d02fffe7a36a2e48128713bd2 (patch) | |
tree | 9b754963bd9583ac0f2297f12c682771b9e4b84b /modules/images.py | |
parent | 5245c7a4935f67b677da0f5a1fc2b74c074aa0e2 (diff) | |
download | stable-diffusion-webui-gfx803-6014fb8afbe05c8d02fffe7a36a2e48128713bd2.tar.gz stable-diffusion-webui-gfx803-6014fb8afbe05c8d02fffe7a36a2e48128713bd2.tar.bz2 stable-diffusion-webui-gfx803-6014fb8afbe05c8d02fffe7a36a2e48128713bd2.zip |
Do nothing if image file already exists.
Diffstat (limited to 'modules/images.py')
-rw-r--r-- | modules/images.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/images.py b/modules/images.py index b9589563..550e53ae 100644 --- a/modules/images.py +++ b/modules/images.py @@ -416,7 +416,11 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i dirname = apply_filename_pattern(opts.directories_filename_pattern or "[prompt_words]", p, seed, prompt).strip('\\ /')
path = os.path.join(path, dirname)
- os.makedirs(path, exist_ok=True)
+ try:
+ os.makedirs(path, exist_ok=True)
+ except FileExistsError:
+ # If the file already exists, continue and allow said file to be overwritten.
+ pass
if forced_filename is None:
basecount = get_next_sequence_number(path, basename)
|