File size: 1,671 Bytes
f630bbd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
#!/usr/bin/env python3
"""
Simple validation script to test if controller imports work
"""
import sys
import os
print("=== VALIDATION SCRIPT ===")
print(f"Python version: {sys.version}")
print(f"Current working directory: {os.getcwd()}")
# Add current directory to path
current_dir = os.path.dirname(os.path.abspath(__file__))
if current_dir not in sys.path:
sys.path.insert(0, current_dir)
print(f"Added {current_dir} to sys.path")
print(f"sys.path[0]: {sys.path[0]}")
# Check if controller directory exists
controller_path = os.path.join(current_dir, 'controller')
print(f"Controller directory exists: {os.path.exists(controller_path)}")
if os.path.exists(controller_path):
print(f"Controller directory contents: {os.listdir(controller_path)}")
# Try import
try:
print("Attempting to import controller.pix2text_controller...")
from controller.pix2text_controller import pix2text_bp
print("✅ SUCCESS: Import worked!")
except ImportError as e:
print(f"❌ FAILED: {e}")
# Try to show what Python can see
print("\nTrying to understand what Python sees:")
for path in sys.path[:5]: # Check first 5 paths
print(f"Path: {path}")
if os.path.exists(path):
try:
items = os.listdir(path)
controller_items = [item for item in items if 'controller' in item.lower()]
if controller_items:
print(f" Controller-related items: {controller_items}")
except Exception as list_error:
print(f" Cannot list: {list_error}")
else:
print(f" Path does not exist")
print("Validation complete.") |