Skip to content

明明utils都存在,并且 都有__init__.py 和 json_util.py 还是一直提示不是一个包 #117

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

Open
swh2026 opened this issue Apr 10, 2025 · 5 comments

Comments

@swh2026
Copy link

swh2026 commented Apr 10, 2025

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
main()
File "D:\ComfyUI\custom_nodes\ComfyUI-to-Python-Extension\comfyui_to_python.py", line 645, in main
run(**vars(pargs))
File "D:\ComfyUI\custom_nodes\ComfyUI-to-Python-Extension\comfyui_to_python.py", line 610, in run
ComfyUItoPython(
File "D:\ComfyUI\custom_nodes\ComfyUI-to-Python-Extension\comfyui_to_python.py", line 554, in init
self.execute()
File "D:\ComfyUI\custom_nodes\ComfyUI-to-Python-Extension\comfyui_to_python.py", line 564, in execute
import_custom_nodes()
File "D:\ComfyUI\custom_nodes\ComfyUI-to-Python-Extension\comfyui_to_python_utils.py", line 15, in import_custom_nodes
import server
File "D:\ComfyUI\server.py", line 34, in
from app.custom_node_manager import CustomNodeManager
File "D:\ComfyUI\app\custom_node_manager.py", line 11, in
from utils.json_util import merge_json_recursive
ModuleNotFoundError: No module named 'utils.json_util'; 'utils' is not a package

@quangnd2911
Copy link

same issue

@swh2026
Copy link
Author

swh2026 commented Apr 22, 2025

同样的问题

这个版本麻烦,我之前用的老版本不会。 这个版本还要屏蔽 官方的 导入代码才可以

@McDo
Copy link

McDo commented Apr 25, 2025

需要修改一下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()

@huan085128
Copy link

先将comfyui_to_python_utils.py和comfyui_to_python.py这两个文件移动到comfyui目录下,然后修改comfyui_to_python_utils.py只需要在import server之前import utils.extra_config就行

@amuge1997
Copy link

把 workflow.py 放到 Comfyui/workflow.py 然后在 Comfyui 目录下 python workflow.py 可以运行

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

5 participants