Nodes/ComfyUI-OllamaPromptsGeneratorTlant/Load Specific Txt File Tlant
ComfyUI Node

Load Specific Txt File Tlant

The 'Just Give Me This One File' Text Loader

By Tlant·Created 2 years ago·Updated 5 months ago· 2
Load Specific Txt File Tlant
    • text
    file_pathC:\path\to\your\file.txt

    Sometimes you don't want a random prompt from a folder - you want that file, the one you know by name, and you want its contents wired into the graph. That's the entire job of this node: give it a path to a .txt file and it returns the file's contents as a STRING. It's the deterministic counterpart to the pack's random loaders, and it's useful in all the places where randomness is the enemy: a fixed negative-prompt library, a stable style block you keep in a file, or a config prompt you edit in a text editor instead of inside ComfyUI's widgets.

    How it works

    There's not much mechanism to get wrong. The single input file_path is checked with os.path.isfile; if it's not a file, the error string is returned as the text output rather than raised (the pack's house style). If the file exists, it's read as UTF-8 and returned. One input, one output: file_path in, text out.

    Note the default value is a Windows-style placeholder - C:\path\to\your\file.txt - which is a hint about who the author targets and a subtle reminder to replace it. If you're on Linux or macOS, use forward slashes and a real path.

    Install

    It's one of the sixteen nodes in the Tlant pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Tlant/ComfyUI-OllamaPromptsGeneratorTlant
    

    restart ComfyUI. Or grab it from ComfyUI Manager ("Load Specific Txt File Tlant"). No extra dependencies beyond requests/aiohttp, which Manager handles.

    Where people get tripped up

    • Path typos are silent-ish. Because errors come back as the text output, a wrong path means your prompt literally becomes the error text. The console also prints it, so check there if something weird reaches the encoder.
    • UTF-8 only. Unlike the random loaders in this pack, this node doesn't try gbk or latin-1 fallbacks - a file saved with a legacy Windows encoding may fail to read. Save your prompt files as UTF-8 and you'll never think about it.
    • Absolute path expected. Relative paths can work depending on ComfyUI's working directory, but don't rely on it - use a full path.

    A trivial node, but a genuinely useful one: version-control your prompts in a folder, reference them by path, and keep the long text out of your graph. When you want one specific file and no surprises, this is the load.

    CategoryTlant

    Inputs (1)

    NameTypeDefaultDescription
    file_pathSTRINGC:\path\to\your\file.txt

    Outputs (1)

    NameTypeDescription
    textSTRING