Comfy-Org / Comfy-Org/ComfyUI

%date% formatting cannot be set for filenames via "String"

Open
#9,503 0 comments 1 reaction 0 assignees View on GitHub
Potential Bug
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

**[Save File Formatting](https://blenderneko.github.io/ComfyUI-docs/Interface/SaveFileFormatting/)** is wonderful when using something like `WAN/%date:yyyy-MM-dd%_%date:hhmmss%_` in the filename field for nodes like Save Image, etc.

However, if the same value is input in a "String" node and fed in to that field, it fails to apply the formatting and results in bad file error (tried to write file including `%` in it)

**EXPECTED BEHAVIOR:**

1. Put a value like ``WAN/%date:yyyy-MM-dd%_%date:hhmmss%_` into a "String" node.
2. Pass that into a `filename` field, such as in "Save Image" node
3. Dynamically updates the filename

### Actual Behavior

fails to apply the formatting and results in bad file error (tried to write file including `%` in it)

### Steps to Reproduce

Do what I wrote above

### Debug Logs

```powershell
Prompt executed in 0.11 seconds
got prompt
!!! Exception during processing !!! [Errno 22] Invalid argument: 'D:\\0_AI\\ComfyUI_windows_portable\\ComfyUI\\output\\xtra\\\\%date:yyyy-MM-dd%_%date:hhmmss%__00001.png'
Traceback (most recent call last):
File "D:\0_AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 496, 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=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\0_AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 315, 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_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\0_AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 289, in _async_map_node_over_list
await process_inputs(input_dict, i)
File "D:\0_AI\ComfyUI_windows_portable\ComfyUI\execution.py", line 277, in process_inputs
result = f(**inputs)
^^^^^^^^^^^
File "D:\0_AI\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-videohelpersuite\videohelpersuite\nodes.py", line 381, in combine_video
Image.fromarray(tensor_to_bytes(first_image)).save(
File "D:\0_AI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\PIL\Image.py", line 2583, in save
fp = builtins.open(filename, "w+b")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 22] Invalid argument: 'D:\\0_AI\\ComfyUI_windows_portable\\ComfyUI\\output\\xtra\\\\%date:yyyy-MM-dd%_%date:hhmmss%__00001.png'
```

### Other

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.