Nodes/comfyui-job-iterator/FormatAttributes
ComfyUI Node Runs on cloud

FormatAttributes

Turn a job step into one readable string with Python format syntax

By ali1234·Created 3 years ago·Updated 3 months ago· 130
FormatAttributes
  • attributes
  • string
format

If a job step is carrying three or four named values and you want them all in one filename or caption, chaining a GetAttribute node for each field plus a bunch of string-concat nodes gets old fast. FormatAttributes collapses that into one node: give it a template and a step's attributes, and it fills the template in for you.

How it works

This one's worth stating precisely because it's exactly what it looks like: the node calls Python's str.format(**attributes) on your template string. You write placeholders using the names you gave your attributes upstream - {seed}, {prompt}, whatever you called them in MakeJob or EnumerateJob - and it substitutes the actual value for that step. There's no custom templating language to learn here; it's real Python string formatting, so anything you already know about .format() applies directly.

The inputs and outputs that matter

  • attributes (ATTRIBUTES) - one step's worth of named values, typically from GetJobStep or a single item out of JobToList's list output.
  • format (STRING, multiline) - your template, e.g. "seed={seed}_cfg={cfg}".

Output is a single string - feed it into a Save Image filename prefix, or into StringToImage's text input to burn it as a caption onto the image itself.

A template like "{i:03d}_seed{seed}" is worth knowing about too - since this is genuine str.format(), you get the full format-spec mini-language for free, so you can zero-pad an index from EnumerateJob into a tidy 007_seed4821-style filename without a separate padding node.

How to install it

Via ComfyUI Manager: search comfyui-job-iterator, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ali1234/comfyui-job-iterator

then restart. No dependencies.

Common issues & troubleshooting

KeyError at queue time. If your template references {name} and that attribute doesn't actually exist on that step's dictionary - misspelled, wrong case, or just never set upstream - Python's .format() raises immediately and the run stops there. Double-check the name matches exactly what you typed into MakeJob or EnumerateJob further up the chain.

A literal curly brace shows up wrong, or errors. Because this is real str.format(), a brace you actually want printed (not as a placeholder) needs to be doubled: {{ for a literal {, }} for a literal }. A single stray brace that isn't a valid placeholder will throw a formatting error.

The output has the right structure but the wrong value type showing. .format() calls str() on whatever value it substitutes, so numbers, lists, and other objects all get stringified automatically - this is one of the few places in the pack where you don't need a separate GetAttributeString step first. If a value looks unexpectedly verbose (like a full tuple printed with parentheses), that's just Python's default string representation of whatever object is actually stored there.

Categoryali1234/job

Inputs (2)

NameTypeDefaultDescription
attributesATTRIBUTES
formatSTRING

Outputs (1)

NameTypeDescription
stringSTRING