Files
aitbc/scripts/wrappers/aitbc-explorer-wrapper.py
aitbc 35d23b2ef9 fix: add REPO_DIR to PYTHONPATH in service wrappers
The wrapper scripts were setting PYTHONPATH to only the app's src directory,
causing 'ModuleNotFoundError: No module named aitbc' when services tried
to import from the aitbc package. Added REPO_DIR to PYTHONPATH in
coordinator-api, agent-coordinator, and explorer wrappers to allow aitbc imports.
2026-04-25 08:08:23 +02:00

33 lines
867 B
Python
Executable File

#!/usr/bin/env python3
"""
Wrapper script for aitbc-explorer service
Uses centralized aitbc utilities for path configuration
"""
import sys
import os
from pathlib import Path
# Add aitbc to path
sys.path.insert(0, str(Path("/opt/aitbc")))
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
# Set up environment using aitbc constants
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
os.environ["PYTHONPATH"] = f"{REPO_DIR}:{REPO_DIR}/apps/blockchain-explorer"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
# Change to explorer directory
os.chdir(f"{REPO_DIR}/apps/blockchain-explorer")
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
"main.py"
]
os.execvp(exec_cmd[0], exec_cmd)