From 72fe66a18be1f4954c63087d6578d7adf823ac8e Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Fri, 15 May 2026 00:48:23 -0700 Subject: [PATCH] Hoist 'import traceback' to top of main.py Minor cleanup from code review: traceback is stdlib so there's no circular-import concern keeping it inline. The 'from nodes import record_node_startup_error' stays inline because nodes.py imports from contexts that would create a cycle at module load time. Ref: ComfyUI-Launcher#303 Amp-Thread-ID: https://ampcode.com/threads/T-019e23a1-2acc-7619-bd0e-f783d1368ef3 Co-authored-by: Amp --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 139eefbae..805977461 100644 --- a/main.py +++ b/main.py @@ -17,6 +17,7 @@ from utils.mime_types import init_mime_types import faulthandler import logging import sys +import traceback from comfy_execution.progress import get_progress_state from comfy_execution.utils import get_executing_context from comfy_api import feature_flags @@ -139,7 +140,6 @@ def execute_prestartup_script(): spec.loader.exec_module(module) return True except Exception as e: - import traceback logging.error(f"Failed to execute startup-script: {script_path} / {e}") from nodes import record_node_startup_error record_node_startup_error(