ComfyUI Node

Path Join

The one node in this pack that's broken out of the box

By kale4eat·Created 2 years ago·Updated 2 years ago· 0
Path Join
    • root
    • ext
    string1
    string2

    Path Join should be the most useful node in this pack: take a folder and a filename, get a properly-joined path with the right separator for your OS. os.path.join() is one of the most-used functions in Python for exactly this. And then you run the node and ComfyUI throws an error. So let's be upfront: as shipped, this node is broken. It's the one trap in an otherwise trivial pack, and the fix is a two-line edit.

    What you're buying with this pack is a set of one-liners wrapping os.path - usually refreshingly boring. Path Join's problem is that it looks like the same thing and isn't.

    What's actually wrong

    Here's the shipped code, roughly:

    RETURN_TYPES = ("STRING", "STRING")
    RETURN_NAMES = ("root", "ext")
    
    def run(self, string1, string2):
        path = os.path.join(string1, string2)
        return (path,)
    

    See it? The node declares two outputs - root and ext, names copy-pasted from the pack's Path Splitext node - but its run method returns one value: the joined path. ComfyUI validates that what a node returns matches what it declares, so when the workflow actually executes this node, it fails with an output-count mismatch. The joining itself works; the node just can't deliver the result.

    The two-input fix

    If you want Path Join working, patch nodes.py in the pack folder - change the declaration to match reality:

    RETURN_TYPES = ("STRING",)
    RETURN_NAMES = ("path",)
    

    Save, restart ComfyUI, and it'll correctly output the joined path as one string. That's the entire fix; the underlying os.path.join(string1, string2) logic was always right.

    Or just skip it

    Honestly, the easiest workaround is to not use it at all. Joining a folder and a filename is trivial to type directly into a string widget, and string-concat nodes from bigger packs (WAS, rgthree, and friends) do the job with less ceremony. The one thing os.path.join gives you that plain + doesn't is OS-correct separators - a real nicety on Windows - but most ComfyUI paths use forward slashes regardless and just work.

    Inputs and outputs (as declared)

    For completeness: inputs are string1 and string2, both STRING with empty defaults. The declared outputs are root and ext, which are wrong for this node - once patched, the single output is the joined path.

    Installing it

    The pack itself installs like its siblings - no dependencies, no pip, no models:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kale4eat/ComfyUI-path-util
    

    Restart ComfyUI (or install via Manager, search "path-util"). The install is the easy part; the edit above is the part that makes Path Join usable. Note that a git pull will overwrite your patch if the author ever updates - keep it in mind, or stick with the skip-it workaround.

    Bottom line

    Every other node in ComfyUI-path-util does exactly what its name says. Path Join doesn't, until you fix it. It's a shame, because a working os.path.join is genuinely handy - just don't be the person who spends an hour debugging a workflow that turns out to be this one node's fault. Now you know the answer in advance.

    Categorypath-util

    Inputs (2)

    NameTypeDefaultDescription
    string1STRING
    string2STRING

    Outputs (2)

    NameTypeDescription
    rootSTRING
    extSTRING