Petty Paint Exec
Run arbitrary Python in your workflow. Know what that means.
- value
- option
- a
- b
- c
- data
Some nodes are utilities. PettyPaintExec is a hole in the floor with a ladder in it - it evaluates arbitrary Python you type into a code box, right in the middle of your workflow, and returns the result as data. Want to compute a value that no stock node produces? Write it. Transform a JSON structure? Write it. Read a file, walk a directory, do anything Python can do on your machine? Write it. There are dedicated "any Python" nodes elsewhere in the ecosystem for exactly this need, and this is the pack's version.
The mechanism is worth being blunt about, because it defines both the power and the danger. The node runs Python's eval() on your code string, with a scope that exposes value (and item, same thing), option, a, b, c, os, and api. Whatever the expression evaluates to is your output. eval() is for expressions, not statements - so your code has to be a single expression like len(value) or value + 2, not a multi-line script with loops. And the node's IS_CHANGED also evals the code, so it re-runs whenever inputs change and the result flows through normally.
The inputs and outputs
value- any type (*), the data your expression works on.code- the multiline STRING box where your expression lives. This is the whole node.option,a,b,c- wildcard extras injected into the eval scope, for threading additional data in.- Output:
data(*) - whatever the expression returned.
Installing it
It ships in the petty-paint pack:
cd ComfyUI/custom_nodes
git clone https://github.com/mephisto83/petty-paint-comfyui-node
Restart ComfyUI, or install via ComfyUI Manager searching "petty-paint-comfyui-node". Declared dependency: Flask==2.1.2, unused here.
Common issues
Let's not bury the lead: this node runs arbitrary code with your full user permissions, and ComfyUI custom nodes in general are un-sandboxed - the KB's ecosystem essay and ComfyUI Manager's own security docs are clear that installing a node is equivalent to running its code. eval() inside a workflow is the same class of risk: any workflow you download that contains a PettyPaintExec can run anything on your machine. Treat downloaded workflows containing this node with real suspicion, and never paste code you don't understand.
On the practical side: since it's eval(), a for loop or assignment raises a SyntaxError - restructure as a single expression (list comprehensions and walrus operators are your friends). If your expression errors, the node throws and the whole queue stops; there's no try/except wrapper. And remember the result is typed dynamically - it comes out as whatever Python made it, so the downstream node has to accept that type. Powerful tool, but it's the one node in the pack that asks you to read before you trust.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| valueopt | * | — | |
| codeopt | STRING | — | |
| optionopt | * | — | |
| aopt | * | — | |
| bopt | * | — | |
| copt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| data | * | — |