Custom node breaks Save File Formatting
Steps to Reproduce
- Launch a clean instance of ComfyUI without any custom nodes.
- Create a simple workflow that loads an image and save the file formatted as
%date:yyyy-MM-dd%, using two methods: a) Usingfilename_prefixdirectlyb) Connect a primitive node after converting
filename_prefixto input - Check the output folder.
- Install
ComfyUI-Custom-Scriptsand relaunch ComfyUI, then retry the two workflows above.
Expected result
Both methods should work just like vanilla ComfyUI, or at least print a warning/error somewhere.
Actual result
With the custom node installed, the first method works flawlessly, while the second method silently broke. If you checked the output folder, an incomplete file %date is created. No console messages was logged by Custom-Scripts or ComfyUI.
Notes
- I've read the README and I don't see anything that mentions this change in behaviour of the save image and primitive node.
- I'm surprised this wasn't reported considering it breaks a core functionality, are there some other issues at play here?
I have the same issue, however if i use "%date:yyyy-MM-dd%/%KSampler.seed%" it gives me the following error:
`Error occurred when executing SaveImage:
[WinError 267] The directory name is invalid: '\ComfyUI_windows_portable\ComfyUI\output\%date:yyyy-MM-dd%'
File "\ComfyUI_windows_portable\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\ComfyUI_windows_portable\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 "\ComfyUI_windows_portable\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1428, 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 "\ComfyUI_windows_portable\ComfyUI\folder_paths.py", line 260, in get_save_image_path os.makedirs(full_output_folder, exist_ok=True) File "", line 225, in makedirs`
Have you set "Run widget replace on values" to true on the primitive node? The default on Primitives is off, so replacements are not run, whereas it always runs on the SaveImage node.
If I enable that, it works fine (but there is a bug with the primitive node reloading these values when you reload the workflow)
Yes, it works fine with that option enabled. Now I wonder how/why does vanilla ComfyUI perform replacements without that option enabled. To further complicate the matter, some users have reported that it doesn't work even without this custom node installed (comfyanonymous/ComfyUI#2832).
I'd like to add that by setting "Run widget replace on values" to true, any time you pull this image into ComfyUI, it will not retain your custom save file formatting, as it will be overwritten with the hard coded result your formatting generated the first time. This is not desired at all. Any way around this?
If I enable that, it works fine (but there is a bug with the primitive node reloading these values when you reload the workflow)
It's a known bug. The workaround, or should I say the proper method, is to use the first method and forego using primitive node entirely.
This is still a bug.