receyuki / comfyui-prompt-reader-node

The ultimate solution for managing image metadata and multi-tool compatibility. ComfyUI node version of the SD Prompt Reader
MIT License
289 stars 22 forks source link

[BUG] - SDPromptSaver cannot consume filename from SDPromptSaver #62

Open klement opened 9 months ago

klement commented 9 months ago

Description

With SDPromptSaver.FILENAME output connected to another SDPromptSaver.FILENAME input, I'm getting the following exception:

Error occurred when executing SDPromptSaver:

'list' object has no attribute 'replace'

  File "D:\ComfyUI\execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "D:\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 "D:\ComfyUI\execution.py", line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "D:\ComfyUI\custom_nodes\comfyui-prompt-reader-node\nodes.py", line 507, in save_images
    stem = self.get_path(filename, variable_map)
  File "D:\ComfyUI\custom_nodes\comfyui-prompt-reader-node\nodes.py", line 600, in get_path
    name = name.replace(variable, str(value))

Reproduction steps

No response

Image file

No response

receyuki commented 8 months ago

Alright, I'll fix this issue in the next version (actually it's a feature, but anyway, I'll make it user-friendly for you).

klement commented 8 months ago

I wasn't able to find a way of creating different versions/formats of images under the same name (in different directories) and this seems like an obvious solution. I tried the rebatch with size 1 but it doesn't help.

I'm curious - if it's a feature then I'd assume there is a use for the feature. What is the use case for this being the way it is now?

receyuki commented 8 months ago

In the current version, even if you set the batch size to 1, the saver will still output the filename as an array of length 1 (which is the problem you're encountering). I initially designed it this way to ensure the filename could be correctly output when the batch size was more than one, but I forgot to consider the situation when the batch size equals one.

Don't worry, I will fix everything.

receyuki commented 8 months ago

Please try the latest version.