ComfyUI_Comfyroll_CustomNodes icon indicating copy to clipboard operation
ComfyUI_Comfyroll_CustomNodes copied to clipboard

An error occurred while retrieving information for the 'CR Select Font' node

Open Lex-DRL opened this issue 1 year ago • 6 comments

The error message from the title is thrown when I start ComfyUI under Linux (Manjaro).

Starting server

To see the GUI go to: http://127.0.0.1:8188
FETCH DATA from: /BigData/SD/SwarmUI/dlbackend/ComfyUI/custom_nodes/ComfyUI-Manager/extension-node-map.json [DONE]
[ERROR] An error occurred while retrieving information for the 'CR Select Font' node.
Traceback (most recent call last):
  File "/BigData/SD/SwarmUI/dlbackend/ComfyUI/server.py", line 443, in get_object_info
    out[x] = node_info(x)
             ^^^^^^^^^^^^
  File "/BigData/SD/SwarmUI/dlbackend/ComfyUI/server.py", line 420, in node_info
    info['input'] = obj_class.INPUT_TYPES()
                    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/BigData/SD/SwarmUI/dlbackend/ComfyUI/custom_nodes/ComfyUI_Comfyroll_CustomNodes/nodes/nodes_graphics_text.py", line 467, in INPUT_TYPES
    file_list = [f for f in os.listdir(font_dir) if os.path.isfile(os.path.join(font_dir, f)) and f.lower().endswith(".ttf")]
                            ^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/fonts/truetype'

Lex-DRL avatar Jul 19 '24 02:07 Lex-DRL

I have the same problem as you, have you solved it?

yincangshiwei avatar Jul 26 '24 02:07 yincangshiwei

Nope. That's why I've opened this issue. It doesn't look like it could be solved on a user side - since it appeared on a clean ComfyUI install. Probably, it's a bug that needs fixing.

ComfyUI works as usual, but this error is spammed really annoyingly.

Lex-DRL avatar Jul 26 '24 05:07 Lex-DRL

Same error on NixOS. The current solution seems to be to manually adjust the path in the variable font_dir (file ComfyUI/custom_nodes/ComfyUI_Comfyroll_CustomNodes/nodes/nodes_graphics_text.py)

        elif platform.system() == "Linux":
            font_dir = "/usr/share/fonts/truetype"

I like the suggestion to use the fc-list command quite well. This also lists all available fonts under NixOS.

Unfortunately, even with Merge Request #124 systems are not taken into account where the path /usr/share/fonts does not even exist.


I also tried creating a symlink to /usr/share/fonts/truetype in my system configuration. But apart from the fact that this is a bit messy and hacky, the subsequent call to os.listdir(…) does not follow any symlinks and results in the same error.

  systemd = {
    tmpfiles.rules = [
      # Symlink not followed, still a ComfyUI Error in `CR Select Font`: No such file or directory: '/usr/share/fonts/truetype'
      "L+ /usr/share/fonts/truetype - - - - ${pkgs.liberation_ttf}/share/fonts/truetype"
    ];
  };

My current and hopefully only temporary workaround on NixOS is to create a folder /run/current-system/sw/share/X11/fonts using the fonts.fontDir option.

fonts.fontDir.enable = true;

Then adjust the variable font_dir in the file ComfyUI/custom_nodes/ComfyUI_Comfyroll_CustomNodes/nodes/nodes_graphics_text.py.

        elif platform.system() == "Linux":
            font_dir = "/run/current-system/sw/share/X11/fonts"

zierf avatar Aug 21 '24 23:08 zierf

At least I found a solution on NixOS if you use a FHS environment (buildFHSUserEnv).

Simply add a package with a TrueType font such as liberation_ttf to the available packages (targetPkgs), which will then provide the path /usr/share/fonts/truetype in that environment with said font.

zierf avatar Aug 29 '24 17:08 zierf

The solution for me was to symlink TTF to truetype sudo ln -s /usr/share/fonts/TTF /usr/share/fonts/truetype

kaidencc avatar Feb 27 '25 01:02 kaidencc

The solution for me was to symlink TTF to truetype sudo ln -s /usr/share/fonts/TTF /usr/share/fonts/truetype

Had the same problem. This workaround gets rid of the error message :)

ProPatte avatar Sep 02 '25 23:09 ProPatte