|
|
|
|
|
""" |
|
|
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()}") |
|
|
|
|
|
|
|
|
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]}") |
|
|
|
|
|
|
|
|
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: |
|
|
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}") |
|
|
|
|
|
|
|
|
print("\nTrying to understand what Python sees:") |
|
|
for path in sys.path[:5]: |
|
|
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.") |