From 9f960448586f0291fd4e006f92c5b3c5498c08a3 Mon Sep 17 00:00:00 2001 From: zkpepe Date: Thu, 28 Aug 2025 20:00:32 +0300 Subject: [PATCH] fix: module loading in `retrieve_vote_script` --- scripts/ci/prepare_environment.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/ci/prepare_environment.py b/scripts/ci/prepare_environment.py index 3d8cfd0d2..3f601546b 100644 --- a/scripts/ci/prepare_environment.py +++ b/scripts/ci/prepare_environment.py @@ -1,4 +1,5 @@ import os +import importlib from typing import Callable, Tuple, List @@ -91,11 +92,11 @@ def retrieve_vote_script() -> Tuple[Callable, Callable] | None: module_name = f"scripts.{script_name}" try: - exec(f"from {module_name} import start_vote, get_vote_items") - return locals()['start_vote'], locals()['get_vote_items'] + module = importlib.import_module(module_name) + return module.start_vote, module.get_vote_items except ImportError: raise AttributeError( f"'start_vote' and/or 'get_vote_items' not found in {script_path}." ) except Exception as e: - raise RuntimeError(f"An unexpected error occurred while importing from {script_path}: {e}") \ No newline at end of file + raise RuntimeError(f"An unexpected error occurred while importing from {script_path}: {e}")