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

[ERROR] An error occurred while retrieving information for the 'IF_ChatPrompt' node. message appeared at ComfyUI console. #133

Open
suito-venus opened this issue Dec 14, 2024 · 3 comments

Comments

@suito-venus
Copy link

Start ComfyUI (Windows) by run_nvidia_gpu.bat, Error messages reported.

Error messages at ComfyUI console.

>run_nvidia_gpu.bat

L:\gai\ComfyUI_windows_portable>.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
[START] Security scan
[DONE] Security scan
...
Starting server

To see the GUI go to: http://127.0.0.1:8188
FETCH DATA from: L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager\extension-node-map.json [DONE]
[ERROR] An error occurred while retrieving information for the 'IF_ChatPrompt' node.
Traceback (most recent call last):
  File "L:\gai\ComfyUI_windows_portable\ComfyUI\server.py", line 579, in get_object_info
    out[x] = node_info(x)
             ^^^^^^^^^^^^
  File "L:\gai\ComfyUI_windows_portable\ComfyUI\server.py", line 546, in node_info
    info['input'] = obj_class.INPUT_TYPES()
                    ^^^^^^^^^^^^^^^^^^^^^^^
  File "L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IFChatPromptNode.py", line 967, in INPUT_TYPES
    node = cls()
           ^^^^^
  File "L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IFChatPromptNode.py", line 383, in __init__
    self.assistants = self.load_presets(self.assistants_file)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IFChatPromptNode.py", line 424, in load_presets        
    presets = json.load(f)
              ^^^^^^^^^^^^
  File "json\__init__.py", line 293, in load
UnicodeDecodeError: 'cp932' codec can't decode byte 0xef in position 5960: illegal multibyte sequence

Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence
Error loading presets from L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json: 'cp932' codec can't decode byte 0x93 in position 198: illegal multibyte sequence

Environment:

Windows 10 (22H2)
pytorch version: 2.4.1+cu124
Python version: 3.11.9

** ComfyUI startup time: 2024-12-14 15:55:49.124876
** Platform: Windows
** Python version: 3.11.9 (tags/v3.11.9:de54cf5, Apr  2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
** Python executable: L:\gai\ComfyUI_windows_portable\python_embeded\python.exe
** ComfyUI Path: L:\gai\ComfyUI_windows_portable\ComfyUI
** Log path: L:\gai\ComfyUI_windows_portable\comfyui.log

ComfyUI\custom_nodes\ComfyUI-IF_AI_tools info:

HEAD: ref: refs/heads/main
FETCH_HEAD in ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools.git\FETCH_HEAD

ff48a9ca2808f184d882cada39a6838aafe0df0f		branch 'main' of https://github.com/if-ai/ComfyUI-IF_AI_tools
42741d6f5156aebe279a1edcfd9c2183fc44576c	not-for-merge	branch 'IF_AI_tools_RAG_linux_mac' of https://github.com/if-ai/ComfyUI-IF_AI_tools

Additional info

import error is not appeared.


Import times for custom nodes:
...

   1.5 seconds: L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools

Starting server
...

Thanks.

@suito-venus
Copy link
Author

ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IF_AI\presets\neg_prompts.json has a binary character 0x93 in line:4 col:137
image
image

After delete that character. No errors appeared.

   1.5 seconds: L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-IF_AI_tools

Starting server

To see the GUI go to: http://127.0.0.1:8188
FETCH DATA from: L:\gai\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager\extension-node-map.json [DONE]

Thanks.

@suito-venus
Copy link
Author

Sry, more change needed.
In ComfyUI\custom_nodes\ComfyUI-IF_AI_tools\IFChatPromptNode.py at line 423

    def load_presets(self, file_path):
        # with open(file_path, 'r') as f:
        with open(file_path, 'r', encoding='utf-8') as f:  # Add encoding='utf-8' option.
            presets = json.load(f)
        return presets

@if-ai
Copy link
Owner

if-ai commented Dec 14, 2024

I added this now

def load_presets(self, file_path: str) -> Dict[str, Any]:
     """
     Load JSON presets with support for multiple encodings.
     
     Args:
         file_path (str): Path to the JSON preset file
         
     Returns:
         Dict[str, Any]: Loaded JSON data or empty dict if loading fails
     """
     # List of encodings to try
     encodings = ['utf-8', 'utf-8-sig', 'latin1', 'cp1252', 'gbk']
     
     for encoding in encodings:
         try:
             with codecs.open(file_path, 'r', encoding=encoding) as f:
                 data = json.load(f)
                 
                 # If successful, write back with UTF-8 encoding to prevent future issues
                 try:
                     with codecs.open(file_path, 'w', encoding='utf-8') as out_f:
                         json.dump(data, out_f, ensure_ascii=False, indent=2)
                 except Exception as write_err:
                     print(f"Warning: Could not write back UTF-8 encoded file: {write_err}")
                     
                 return data
                 
         except UnicodeDecodeError:
             continue
         except json.JSONDecodeError as e:
             print(f"JSON parsing error with {encoding} encoding: {str(e)}")
             continue
         except Exception as e:
             print(f"Error loading presets from {file_path} with {encoding} encoding: {e}")
             continue
             
     print(f"Error: Failed to load {file_path} with any supported encoding")
     return {}

should handle chinese letters

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

2 participants