Nodes/comfy-ovum/STRING to PATHLIKE (PurePath)
ComfyUI Node

STRING to PATHLIKE (PurePath)

Turn a path string into a pathlib.PurePath for type-safe wiring

By sfinktah·Created about a year ago·Updated 10 months ago· 7
STRING to PATHLIKE (PurePath)
    • pathlike
    path

    ComfyUI speaks path strings - C:\output\batch\file.png, /models/checkpoints/foo.safetensors. Python's pathlib speaks path objects - PurePath values that know how to join, split, and compare themselves. OvumPathToPathLike ("STRING to PATHLIKE (PurePath)") is the little adapter that converts one to the other, so you can wire a plain text path into the pack's os.path-style nodes that expect a PATHLIKE input. It's a one-trick node, but it's the glue that makes the path utilities usable from real workflow data.

    How it works

    One input, one output, nothing clever:

    • path (STRING) - the path string, typed or pasted, e.g. C:\output\images.
    • pathlike (PATHLIKE,STRING) - the same path as a pathlib.PurePath object.

    Under the hood it just runs PurePath(path) on the string. PurePath is "pure" because it does no filesystem access - it's a syntax-level representation. That means it works on paths for files that don't exist yet (like a future output path) and it's cheap and side-effect free. The output type is dual-typed as PATHLIKE,STRING, so in practice it also passes through as a string where that's what the downstream node expects - which makes it forgiving to wire.

    Why you'd reach for it

    This node exists to satisfy type expectations. The comfy-ovum pack's ovum/path nodes (os.path.basename, join, splitext, exists, and the rest) accept either a widget string or a link, and some of them accept a PATHLIKE link. When you're driving those from another node's string output rather than typing into the widget, OvumPathToPathLike is how you make the connection type-safe. It also gives you a hook to preview the parsed path in the graph - handy when a string has backslashes and you want to confirm how Python will read it.

    Installing it

    Ships in comfy-ovum. ComfyUI Manager → search "comfy-ovum", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/sfinktah/comfy-ovum
    

    Restart, find it under ovum/path. No model downloads, no dependencies worth mentioning - pathlib is in the standard library.

    The gotcha

    Don't overthink it. If your workflow is entirely string-based, you can skip this node and let the path utilities take the widget string directly - the adapter only earns its keep when you're linking values between nodes. And remember PurePath is syntax-only: it won't tell you a file exists (that's os.path.exists in this pack) or normalize a path to the real filesystem (that's realpath). Convert for wiring, not for truth about the disk.

    Categoryovum/path

    Inputs (1)

    NameTypeDefaultDescription
    pathSTRING

    Outputs (1)

    NameTypeDescription
    pathlikePATHLIKE,STRING