#!/usr/bin/env python3 """ SciPaperLoader Diagnostic Tools - One-click launcher This script provides a simple way to launch the diagnostic menu. """ import os import sys import subprocess from pathlib import Path # Find the diagnostic_menu.py script SCRIPT_DIR = Path(__file__).parent MENU_SCRIPT = SCRIPT_DIR / "diagnostics" / "diagnostic_menu.py" def main(): """Run the diagnostic menu.""" # Check if diagnostics directory exists diagnostics_dir = SCRIPT_DIR / "diagnostics" if not diagnostics_dir.exists(): print(f"Error: Diagnostics directory not found at {diagnostics_dir}") print("Make sure you're running this script from the project root directory.") return 1 # Check if menu script exists if not MENU_SCRIPT.exists(): print(f"Error: Diagnostic menu not found at {MENU_SCRIPT}") print("Available files in the diagnostics directory:") try: for file in diagnostics_dir.glob("*.py"): print(f" - {file.name}") except Exception: print(" Could not list files in the diagnostics directory.") return 1 # Ensure the script is executable if not os.access(MENU_SCRIPT, os.X_OK): try: os.chmod(MENU_SCRIPT, os.stat(MENU_SCRIPT).st_mode | 0o100) except Exception as e: print(f"Warning: Could not make script executable: {e}") # Run the menu script try: subprocess.run([sys.executable, str(MENU_SCRIPT)], check=True) return 0 except subprocess.CalledProcessError as e: print(f"Error running diagnostic menu: {e}") return 1 if __name__ == "__main__": sys.exit(main())