|
|
|
|
|
""" |
|
|
Debug script to test Docker environment |
|
|
""" |
|
|
|
|
|
import os |
|
|
import sys |
|
|
|
|
|
print("=== DOCKER DEBUG INFO ===") |
|
|
print(f"Current working directory: {os.getcwd()}") |
|
|
print(f"Python executable: {sys.executable}") |
|
|
print(f"Python version: {sys.version}") |
|
|
|
|
|
print("\nEnvironment variables:") |
|
|
for key in ['PYTHONPATH', 'PATH']: |
|
|
print(f" {key}: {os.environ.get(key, 'Not set')}") |
|
|
|
|
|
print("\nDirectory structure:") |
|
|
try: |
|
|
for root, dirs, files in os.walk('.'): |
|
|
level = root.replace('.', '').count(os.sep) |
|
|
indent = ' ' * 2 * level |
|
|
print(f"{indent}{os.path.basename(root)}/") |
|
|
subindent = ' ' * 2 * (level + 1) |
|
|
for file in files: |
|
|
if file.endswith('.py'): |
|
|
print(f"{subindent}{file}") |
|
|
if level > 3: |
|
|
break |
|
|
except Exception as e: |
|
|
print(f"Error walking directory: {e}") |
|
|
|
|
|
print("\nTrying to import controller...") |
|
|
try: |
|
|
import controller |
|
|
print("✓ controller imported successfully") |
|
|
print(f"Controller file: {controller.__file__}") |
|
|
except ImportError as e: |
|
|
print(f"✗ Failed to import controller: {e}") |
|
|
|
|
|
print("\nTrying to import controller.pix2text_controller...") |
|
|
try: |
|
|
from controller.pix2text_controller import pix2text_bp |
|
|
print("✓ controller.pix2text_controller imported successfully") |
|
|
except ImportError as e: |
|
|
print(f"✗ Failed to import controller.pix2text_controller: {e}") |
|
|
|
|
|
print("\nPython path:") |
|
|
for i, path in enumerate(sys.path): |
|
|
print(f" {i}: {path}") |
|
|
if os.path.exists(path): |
|
|
try: |
|
|
items = os.listdir(path) |
|
|
py_items = [item for item in items if item.endswith('.py') or os.path.isdir(os.path.join(path, item))] |
|
|
if py_items: |
|
|
print(f" Contains: {', '.join(py_items[:10])}") |
|
|
except: |
|
|
print(f" (Cannot list directory)") |
|
|
else: |
|
|
print(f" (Path does not exist)") |