Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions scripts/ci/prepare_environment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import importlib

from typing import Callable, Tuple, List

Expand Down Expand Up @@ -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}")
raise RuntimeError(f"An unexpected error occurred while importing from {script_path}: {e}")