TextProcessingNode wraps output in list
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 153
Description
### Custom Node Testing
- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)
### Expected Behavior
Workflow runs without errors
### Actual Behavior
SaveImageTextDataSetToFolderNode throws an error, but this is caused by AddTextPrefixNode.
### Steps to Reproduce
Any workflow containing these two nodes is able to reproduce the error.
### Debug Logs
```powershell
!!! Exception during processing !!! write() argument must be str, not list
Traceback (most recent call last):
File "/raid/home/anon/comfy/ComfyUI/execution.py", line 518, in execute
output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=ex
ecution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/raid/home/anon/comfy/ComfyUI/execution.py", line 329, in get_output_data
return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_c
b=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/raid/home/anon/comfy/ComfyUI/execution.py", line 297, in _async_map_node_over_list
await process_inputs(input_data_all, 0, input_is_list=input_is_list)
File "/raid/home/anon/comfy/ComfyUI/execution.py", line 291, in process_inputs
result = f(**inputs)
^^^^^^^^^^^
File "/raid/home/anon/comfy/ComfyUI/comfy_api/internal/__init__.py", line 149, in wrapped_func
return method(locked_class, **inputs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/raid/home/anon/comfy/ComfyUI/comfy_api/latest/_io.py", line 1655, in EXECUTE_NORMALIZED
to_return = cls.execute(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/raid/home/anon/comfy/ComfyUI/comfy_extras/nodes_dataset.py", line 284, in execute
f.write(caption)
TypeError: write() argument must be str, not list
```
### Other
The TextProcessingNode base wraps the result in a list. That's how I solved it.
```diff
diff --git a/comfy_extras/nodes_dataset.py b/comfy_extras/nodes_dataset.py
index 5ef851bd..a78427db 100644
--- a/comfy_extras/nodes_dataset.py
+++ b/comfy_extras/nodes_dataset.py
@@ -589,7 +589,7 @@ class TextProcessingNode(io.ComfyNode):
return io.NodeOutput(result if is_group else [result])
else:
# Single output - wrap in list for NodeOutput
- return io.NodeOutput([result])
+ return io.NodeOutput(result)
@classmethod
def _process(cls, text, **kwargs):
```
But I think the TextProcessingNode is also missing the logic for auto-detect is_output_list.
Contributor guide
Assessment
This issue has not been assessed yet.