明明utils都存在,并且 都有__init__.py 和 json_util.py 还是一直提示不是一个包
Current working directory: D:\ComfyUI\custom_nodes\ComfyUI-to-Python-Extension
ComfyUI found: D:\ComfyUI
'D:\ComfyUI' added to sys.path
Traceback (most recent call last):
File "D:\ComfyUI\custom_nodes\ComfyUI-to-Python-Extension\comfyui_to_python.py", line 651, in
same issue
同样的问题
这个版本麻烦,我之前用的老版本不会。 这个版本还要屏蔽 官方的 导入代码才可以
需要修改一下comfyui_to_python_utils.py
def import_custom_nodes() -> None:
"""Find all custom nodes in the custom_nodes folder and add those node objects to NODE_CLASS_MAPPINGS
This function sets up a new asyncio event loop, initializes the PromptServer,
creates a PromptQueue, and initializes the custom nodes.
"""
import asyncio
import execution
from nodes import init_extra_nodes
import server
###############加入以下这三行代码#################
from main import apply_custom_paths, execute_prestartup_script
apply_custom_paths()
execute_prestartup_script()
###############################################
# Creating a new event loop and setting it as the default loop
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
# Creating an instance of PromptServer with the loop
server_instance = server.PromptServer(loop)
execution.PromptQueue(server_instance)
# Initializing custom nodes
init_extra_nodes()
先将comfyui_to_python_utils.py和comfyui_to_python.py这两个文件移动到comfyui目录下,然后修改comfyui_to_python_utils.py只需要在import server之前import utils.extra_config就行
把 workflow.py 放到 Comfyui/workflow.py 然后在 Comfyui 目录下 python workflow.py 可以运行
需要修改一下comfyui_to_python_utils.py
def import_custom_nodes() -> None: """Find all custom nodes in the custom_nodes folder and add those node objects to NODE_CLASS_MAPPINGS This function sets up a new asyncio event loop, initializes the PromptServer, creates a PromptQueue, and initializes the custom nodes. """ import asyncio import execution from nodes import init_extra_nodes import server ###############加入以下这三行代码################# from main import apply_custom_paths, execute_prestartup_script apply_custom_paths() execute_prestartup_script() ############################################### # Creating a new event loop and setting it as the default loop loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) # Creating an instance of PromptServer with the loop server_instance = server.PromptServer(loop) execution.PromptQueue(server_instance) # Initializing custom nodes init_extra_nodes()
import server 那行报错,你把代码加在报错行的后面
📁 ComfyUI/utils → ComfyUI/utilities folder name chane and fix import path
1️⃣ change folder name
mv ComfyUI/utils ComfyUI/utilities
and then fix all import error.
from utils.install_util import get_missing_requirements_message, requirements_path
change like this. at ComfyUI/app/frontend_management.py
from utilities.install_util import get_missing_requirements_message, requirements_path
It is recommended to use portable comfyui instead of desktop version, and then use my pr version, https://github.com/pydn/ComfyUI-to-Python-Extension/pull/133