nkchocoai / ComfyUI-SaveImageWithMetaData

Custom node for ComfyUI. Add a node to save images with metadata (PNGInfo) extracted from the input values of each node.
GNU General Public License v3.0
35 stars 10 forks source link

Error on SaveWithMetadata #31

Open Oninaig opened 3 months ago

Oninaig commented 3 months ago

When passing images into SaveWithMetadata, I will wind up with the following error:

Error occurred when executing SaveImageWithMetaData:

expected str, bytes or os.PathLike object, not NoneType

  File "/home/matt/llm/comfy/ComfyUI/execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/matt/llm/comfy/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 "/home/matt/llm/comfy/ComfyUI/execution.py", line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/matt/llm/comfy/ComfyUI/custom_nodes/ComfyUI-SaveImageWithMetaData/py/nodes/node.py", line 79, in save_images
    pnginfo_dict_src = self.gen_pnginfo(
                       ^^^^^^^^^^^^^^^^^
  File "/home/matt/llm/comfy/ComfyUI/custom_nodes/ComfyUI-SaveImageWithMetaData/py/nodes/node.py", line 165, in gen_pnginfo
    inputs = Capture.get_inputs()
             ^^^^^^^^^^^^^^^^^^^^
  File "/home/matt/llm/comfy/ComfyUI/custom_nodes/ComfyUI-SaveImageWithMetaData/py/capture.py", line 46, in get_inputs
    v = selector(
        ^^^^^^^^^
  File "/home/matt/llm/comfy/ComfyUI/custom_nodes/ComfyUI-SaveImageWithMetaData/py/defs/ext/efficiency_nodes.py", line 11, in get_lora_model_hash_stack
    return [
           ^
  File "/home/matt/llm/comfy/ComfyUI/custom_nodes/ComfyUI-SaveImageWithMetaData/py/defs/ext/efficiency_nodes.py", line 12, in 
    calc_lora_hash(model_name, input_data)
  File "/home/matt/llm/comfy/ComfyUI/custom_nodes/ComfyUI-SaveImageWithMetaData/py/defs/formatters.py", line 28, in calc_lora_hash
    return calc_hash(filename)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/matt/llm/comfy/ComfyUI/custom_nodes/ComfyUI-SaveImageWithMetaData/py/utils/hash.py", line 12, in calc_hash
    with open(filename, "rb") as f:
         ^^^^^^^^^^^^^^^^^^^^
nkchocoai commented 3 months ago

Would you give me the workflow file?

BouTschang commented 3 months ago

Sorry but I have the same problem. Is it fixed?

nkchocoai commented 3 months ago

@BouTschang Not fixed yet. It would be helpful if you could attach the workflow file.

lowmanshigh commented 3 months ago

Same issue too, was working fine, no changes then suddenly stopped working yesterday:

Error occurred when executing SaveImageWithMetaData: expected str, bytes or os.PathLike object, not NoneType

Sorry i can't attach the workflow

Vik71it commented 3 months ago

Same problem here, just began today, with rel. 0f9c2a7

(I'm sending also the workflow I'm using)

The error log:

Error occurred when executing SaveImageWithMetaData:

expected str, bytes or os.PathLike object, not NoneType

File "N:\Stability Matrix\Data\Packages\ComfyUI-OLD\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "N:\Stability Matrix\Data\Packages\ComfyUI-OLD\execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "N:\Stability Matrix\Data\Packages\ComfyUI-OLD\execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "N:\Stability Matrix\Data\Packages\ComfyUI-OLD\custom_nodes\ComfyUI-SaveImageWithMetaData\py\nodes\node.py", line 79, in save_images
pnginfo_dict_src = self.gen_pnginfo(
File "N:\Stability Matrix\Data\Packages\ComfyUI-OLD\custom_nodes\ComfyUI-SaveImageWithMetaData\py\nodes\node.py", line 165, in gen_pnginfo
inputs = Capture.get_inputs()
File "N:\Stability Matrix\Data\Packages\ComfyUI-OLD\custom_nodes\ComfyUI-SaveImageWithMetaData\py\capture.py", line 64, in get_inputs
v = format(v, input_data)
File "N:\Stability Matrix\Data\Packages\ComfyUI-OLD\custom_nodes\ComfyUI-SaveImageWithMetaData\py\defs\formatters.py", line 56, in extract_embedding_hashes
embedding_hashes.append(calc_hash(embedding_file_path))
File "N:\Stability Matrix\Data\Packages\ComfyUI-OLD\custom_nodes\ComfyUI-SaveImageWithMetaData\py\utils\hash.py", line 12, in calc_hash
with open(filename, "rb") as f:

Error.json

Vik71it commented 3 months ago

Same problem here, just began today, with rel. 0f9c2a7

(I'm sending also the workflow I'm using)

The error log:


Error occurred when executing SaveImageWithMetaData:

[...]
[Error.json](https://github.com/user-attachments/files/16651791/Error.json)

Quite strangely, it didn't happen again, after reloading Stability Matrix and this version of ComfyUI...

nkchocoai commented 3 months ago

@Vik71it

Error.json

It looks like the prompt contains “embedding:hoge” and the embedding file does not exist, so it is outputting an error.

Pycpik commented 3 months ago

I have the same error each time I use an (existing) embedding. Tried with embeddings in ComfyUI\models\embeddings or in my old A1111 install with extra_model_paths.

Nice node by the way :)

fredericklessing commented 3 weeks ago

It does seem like the embedding.py does not do recursive iteration on subdirectories. Example, I store my files per model type, ie SDXL, Pony, SD1.5. So my file path looks like embeddings\sdxl\detailxl.safetensor

Another issue, is if the embedding name has a space in, ie "sdgen 1girl.safetensor", it stops reading after the space. But I'm trying to see what I can do to resolve it myself, without having to take my embeddings out of the equation.