From 791f4e939dd7ac3eae2eed127b4fe3070b0858a0 Mon Sep 17 00:00:00 2001 From: emozilla Date: Wed, 27 May 2026 22:42:24 -0400 Subject: [PATCH] fix(setup): drop shadowing inner importlib.util re-imports _print_setup_summary and _setup_tts_provider each had 'import importlib.util' inside a try: block nested deeper in the function body. Python flips importlib to function-local for the whole scope, so earlier references in the same function (the neutts branches at lines 493 / 1109) hit UnboundLocalError before the late import can run. The top-of-module 'import importlib.util' at line 14 already covers both call sites, so dropping the redundant inner imports restores the intended behavior. --- hermes_cli/setup.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/hermes_cli/setup.py b/hermes_cli/setup.py index 61f3eb27460..d5f77d4c540 100644 --- a/hermes_cli/setup.py +++ b/hermes_cli/setup.py @@ -499,7 +499,6 @@ def _print_setup_summary(config: dict, hermes_home): tool_status.append(("Text-to-Speech (NeuTTS — not installed)", False, "run 'hermes setup tts'")) elif tts_provider == "kittentts": try: - import importlib.util kittentts_ok = importlib.util.find_spec("kittentts") is not None except Exception: kittentts_ok = False @@ -1252,7 +1251,6 @@ def _setup_tts_provider(config: dict): elif selected == "kittentts": # Check if already installed try: - import importlib.util already_installed = importlib.util.find_spec("kittentts") is not None except Exception: already_installed = False