Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Lex-DRL opened this issue Jul 19, 2024 · 5 comments

Comments

@Lex-DRL
Copy link

Lex-DRL commented Jul 19, 2024

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'
@yincangshiwei
Copy link

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

@Lex-DRL
Copy link
Author

Lex-DRL commented Jul 26, 2024

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.

@zierf
Copy link

zierf commented Aug 21, 2024

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
Copy link

zierf commented Aug 29, 2024

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.

@Kaiden-AC
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants