Nodes/comfy-ovum/os.path.isfile
ComfyUI Node

os.path.isfile

The 'does my output actually exist' check every automation graph needs

By sfinktah·Created about a year ago·Updated 10 months ago· 7
os.path.isfile
  • path_in
  • isfile
path

If you build ComfyUI graphs that do anything beyond "generate one image and stare at it," this is the node you'll reach for most from the whole path family. os.path.isfile answers the single most important question in automation: is there actually a regular file at this path, right now? It's the difference between a workflow that tries to open a file that isn't there and one that gracefully routes around it.

It comes from the ovum/path/os.path family in comfy-ovum, sfinktah's utility pack, and it's a direct wrapper over Python's os.path.isfile(). No cleverness, no caching - stdlib semantics, straight through.

How it works

Predicate, returns a BOOLEAN (isfile). Path from:

  • path (STRING, required): the widget.
  • path_in (PATHLIKE,STRING, optional): link-only input; connected value overrides the widget.

The stdlib contract applies: missing file → False, directory → False, file you can't stat → False. It never raises. That's the whole reason predicates are safe to chain into logic without guarding them.

The patterns that matter

Three setups make this node earn its keep:

  • Post-save existence gate. Wire your saver's output path in, check isfile, and only then run the "open in player" or "post-process" branch. Your run can't crash on a missing output anymore.
  • Polling for external files. Watch a folder where another process drops files. Loop on isfile; when it flips to True, proceed. Combine with os.path.getmtime to wait until the file stops growing so you don't read a half-written file.
  • Dispatch on path type. isfile vs os.path.isdir gives you a clean three-way branch: file, folder, or neither - the skeleton of any "process this batch directory" graph.

Installing it

Standard pack install, once:

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

Or search "comfy-ovum" in ComfyUI Manager, install, restart. No models, no extra deps - pure stdlib.

Gotchas

  • "Exists" is not "is a file." A path that points at a directory, or a broken symlink, returns False. If you need the looser "does anything exist here, including a broken link," use os.path.lexists; if you need "is it a directory," use isdir.
  • Regular file only. Special files (devices, sockets, named pipes) aren't "regular files" and return False. You almost certainly don't care about that - but it's the difference between isfile and exists, and it explains the odd False on exotic paths.
  • Symlinks that point at a real file return True (it follows the link). islink is the one that asks "is this entry a link."

For any workflow that watches, waits, or gates on disk state, isfile is the node you didn't know you were missing. It's boring, and that's a compliment.

Categoryovum/path/os.path

Inputs (2)

NameTypeDefaultDescription
pathSTRING
path_inoptPATHLIKE,STRING

Outputs (1)

NameTypeDescription
isfileBOOLEAN