ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

save file image using formatting doesn't work

Open abyz22 opened this issue 1 year ago • 7 comments

After updating comfyui, the method of inserting a date into the filename prefix does not work. If i save the image after inserting the value %date:yyyy-MM-dd%/%date:hhmm% in the filename prefix, the following error is showed:

Error occurred when executing SaveImage:

[WinError 267] The directory name is invalid.: 'E:\ComfyUI\output\%date:yyyy-MM-dd%'

File "E:\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI\nodes.py", line 1440, in save_images full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir, images[0].shape[1], images[0].shape[0]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI\folder_paths.py", line 260, in get_save_image_path os.makedirs(full_output_folder, exist_ok=True) File "", line 225, in makedirs

abyz22 avatar Feb 18 '24 23:02 abyz22

Could it be caused by one of your extensions? I've encountered this issue with ComfyUI-Custom-Scripts installed. I don't really understand why. With that extension installed, instead of using a primitive node plugged into the save image node, I can directly use the date format in filename_prefix (without converting to widget).

dexeonify avatar Feb 19 '24 04:02 dexeonify

It's happening for me too. I updated ComfyUI today, and I get the same error due to date strings in a workflow that hasn't changed in a while. It has been a couple of months since I last updated ComfyUI.

I tried removing the primitive plugged into SaveImage, but that didn't solve it.

I was going to look alternative ways of saving files, and it seems I already have a node called Image Save as well as one from Searge in there. Unfortunately I haven't had the opportunity to try them out. I just replaced my date formatting template stuff with today's date, which worked for what I needed today.

Stuie avatar Feb 20 '24 05:02 Stuie

It's happening for me too. I updated ComfyUI today, and I get the same error due to date strings in a workflow that hasn't changed in a while. It has been a couple of months since I last updated ComfyUI.

I tried removing the primitive plugged into SaveImage, but that didn't solve it.

I was going to look alternative ways of saving files, and it seems I already have a node called Image Save as well as one from Searge in there. Unfortunately I haven't had the opportunity to try them out. I just replaced my date formatting template stuff with today's date, which worked for what I needed today.

i solved this problem, would you remove that 'save image' node and redeploy? update and not redeploy made an error but after redeploy the error doesn't showed

abyz22 avatar Feb 21 '24 06:02 abyz22

i solved this problem, would you remove that 'save image' node and redeploy? update and not redeploy made an error but after redeploy the error doesn't showed

I tried remove that 'save image' node and redeploy but still come up the same error

1038lab avatar Feb 25 '24 18:02 1038lab

Just replied in https://github.com/comfyanonymous/ComfyUI/issues/2905

felipesilvame avatar Mar 02 '24 23:03 felipesilvame

... With that extension installed, instead of using a primitive node plugged into the save image node, I can directly use the date format in filename_prefix (without converting to widget).

You are absolutely right. Removing the Primitive node and converting filename_prefix to widget magically solves the problem. At first the GUI needs to be reloaded for this fix to work, but it finally works and saved me from installing yet another plugin.

andreszs avatar Mar 15 '24 20:03 andreszs

I finally got this to work, but I had to do multiple rounds of removing the widget, re-adding the widget rebooting the server. I literally tried 3 or 4 times or else it would just not substitute things into the string and add the things with the percent signs around them in the filename.

So if it doesn't work, try again and again and again and maybe you'll get lucky. :-/

sfisher avatar Jul 31 '24 19:07 sfisher