Nodes/ComfyUI_demucus/Path Abspath
ComfyUI Node

Path Abspath

When ComfyUI can't find the file you meant

By kale4eat·Created 2 years ago·Updated 2 years ago· 0
Path Abspath
    • abspath
    path

    Every ComfyUI workflow is full of path strings: checkpoint names, Lora filenames, image loads, the prefix you save under. Most of the time you type them and it just works. But every so often a node hands you a relative path - something like output/img.png - and another node expects an absolute one, and you spend ten minutes wondering why it can't find the file. Path Abspath is the one-input fix for that.

    It's exactly what it sounds like: you feed it a path, it hands back the absolute version. The name is the whole contract. There's no API, no key, no model download - the entire node is a wrapper around Python's os.path.abspath(), and that's the entire story.

    How it works

    Under the hood it calls os.path.abspath(path) and returns the result as a string. Two things worth knowing about that call:

    • It's pure string math. It resolves . and .. and makes the path absolute, but it does not touch the disk - a path to a file that doesn't exist resolves perfectly fine. If you want to know whether the thing actually exists, that's the separate Path Exists node in the same pack.
    • "Absolute" is measured from the working directory of the process that's running. For ComfyUI that's the folder you launched the server from - normally the ComfyUI install root. So output/img.png becomes /home/you/ComfyUI/output/img.png (or the Windows equivalent), not "relative to wherever this workflow file lives."

    Inputs and outputs

    Just the one you care about:

    • path (STRING, default empty) - the path to absolutize. Type it or wire it in from another node's string output.
    • abspath (STRING) - the output, an absolute path with native separators for your OS.

    Wire abspath into any node that accepts a string path - a loader, a custom node that takes a file path, or another string utility. The output is a plain STRING, so it composes with the rest of this pack: run it through Path Basename, or feed it to Path Exists to confirm the file is there before doing something with it.

    Installing it

    This is one of the rare custom-node installs with zero moving parts. No requirements.txt, no pip step, no model files - it's pure Python standard library, so there are no dependency conflicts to fight (a relief, because dependency hell is the #1 reason workflow downloads fail to run).

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

    Then restart ComfyUI. Or, if you run ComfyUI Manager (and you should), open Custom Nodes Manager, search for "path-util", and hit Install.

    Common issues

    The one trap here is expectations: people assume abspath means "the path is now correct on every machine." It isn't - it just resolves relative to this machine's ComfyUI folder. If you copy a workflow to another machine or a different install location, the absolutized path changes. And if you feed it an empty string, you get the working directory itself back, which is probably not what you meant. The fix is the same in both cases: know where your server runs, or use Path Relpath if what you actually want is a portable, machine-independent path.

    It's a humble node - a one-liner, really. But string plumbing like this is the unglamorous glue that keeps larger workflows honest.

    Categorypath-util

    Inputs (1)

    NameTypeDefaultDescription
    pathSTRING

    Outputs (1)

    NameTypeDescription
    abspathSTRING