#!/usr/bin/env python3 """ Import helper module for CLI scripts that need to import backend services. This ensures the Python path is set up correctly to import from the backend directory. """ import sys from pathlib import Path # Add the project root to the Python path PROJECT_ROOT = Path(__file__).parent.resolve() if str(PROJECT_ROOT) not in sys.path: sys.path.insert(0, str(PROJECT_ROOT)) # Add the backend directory to the Python path for app.* imports BACKEND_ROOT = PROJECT_ROOT / "backend" if str(BACKEND_ROOT) not in sys.path: sys.path.insert(0, str(BACKEND_ROOT)) # Verify that we can import from backend try: from backend.app.config import PROJECT_ROOT as CONFIG_PROJECT_ROOT from app.services.tts_service import TTSService from app.services.speaker_service import SpeakerManagementService except ImportError as e: print(f"Warning: Could not import backend services: {e}") print(f"Make sure you're running from the project root directory: {PROJECT_ROOT}") print(f"Backend directory: {BACKEND_ROOT}")