From fa4d3631f608b27468b34a30885bab106e4d8030 Mon Sep 17 00:00:00 2001 From: atmaranto <35581227+atmaranto@users.noreply.github.com> Date: Wed, 20 Mar 2024 03:47:48 -0500 Subject: [PATCH] Set __main__ path to ComfyUI's main.py --- comfyui_to_python_utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/comfyui_to_python_utils.py b/comfyui_to_python_utils.py index 447693b..184ff09 100644 --- a/comfyui_to_python_utils.py +++ b/comfyui_to_python_utils.py @@ -65,6 +65,11 @@ def add_comfyui_directory_to_sys_path() -> None: comfyui_path = find_path('ComfyUI') if comfyui_path is not None and os.path.isdir(comfyui_path): sys.path.append(comfyui_path) + import __main__ + + if getattr(__main__, "__file__", None) is None: + __main__.__file__ = os.path.join(comfyui_path, "main.py") + print(f"'{comfyui_path}' added to sys.path")