WASasquatch / was-node-suite-comfyui

An extensive node suite for ComfyUI with over 210 new nodes
MIT License
1.22k stars 177 forks source link

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 1834: invalid continuation byte #450

Closed klossm closed 3 months ago

klossm commented 3 months ago

This has been fixed after reinstalling python and the environment.

Traceback (most recent call last): File "L:\stable-diffusion\extensions\sd-webui-comfyui\ComfyUI\custom_nodes\was-node-suite-comfyui\WAS_Node_Suite.py", line 335, in packages result = subprocess.check_output([sys.executable, '-m', 'pip', 'freeze'], stderr=subprocess.STDOUT) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 421, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 526, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['L:\stable-diffusion\venv\Scripts\python.exe', '-m', 'pip', 'freeze']' returned non-zero exit status 2.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "L:\stable-diffusion\extensions\sd-webui-comfyui\ComfyUI\nodes.py", line 1931, in load_custom_node module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "L:\stable-diffusion\extensions\sd-webui-comfyui\ComfyUI\custom_nodes\was-node-suite-comfyui__init__.py", line 1, in from .WAS_Node_Suite import NODE_CLASS_MAPPINGS File "L:\stable-diffusion\extensions\sd-webui-comfyui\ComfyUI\custom_nodes\was-node-suite-comfyui\WAS_Node_Suite.py", line 14314, in if 'opencv-python' in packages() or 'opencv-python-headless' in packages(): File "L:\stable-diffusion\extensions\sd-webui-comfyui\ComfyUI\custom_nodes\was-node-suite-comfyui\WAS_Node_Suite.py", line 339, in packages print("An error occurred while fetching packages:", e.output.decode()) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 1834: invalid continuation byte

Cannot import L:\stable-diffusion\extensions\sd-webui-comfyui\ComfyUI\custom_nodes\was-node-suite-comfyui module for custom nodes: 'utf-8' codec can't decode byte 0xc3 in position 1834: invalid continuation byte

Import times for custom nodes: 6.1 seconds (IMPORT FAILED): L:\stable-diffusion\extensions\sd-webui-comfyui\ComfyUI\custom_nodes\was-node-suite-comfyui

xiaowuzicode commented 1 month ago

How did you solve it?

xiaowuzicode commented 1 month ago

def packages(versions=False): import sys import subprocess try: venv_python_path = sys.executable result = subprocess.check_output([venv_python_path, '-m', 'pip', 'freeze'], stderr=subprocess.STDOUT) lines = result.decode(errors='replace').splitlines() return [line if versions else line.split('==')[0] for line in lines] except subprocess.CalledProcessError as e: print("An error occurred while fetching packages:", e.output.decode(errors='replace')) return []

为了避免 UnicodeDecodeError,你可以尝试在解码输出时使用 errors='ignore' 或 errors='replace',这样可以忽略或替换无法解码的字节。