-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython debug_main.py
More file actions
98 lines (77 loc) · 3.36 KB
/
python debug_main.py
File metadata and controls
98 lines (77 loc) · 3.36 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script para depurar el main.py y verificar por qué no aparecen las herramientas
"""
import sys
import os
def debug_main():
"""Depura el funcionamiento del main.py"""
print("🔍 DEPURANDO MAIN.PY")
print("="*50)
# Verificar archivos principales
required_files = ['main.py', 'tool_manager.py', 'language_selector.py']
print("\n📄 Verificando archivos principales:")
for file in required_files:
if os.path.exists(file):
print(f" ✅ {file}")
else:
print(f" ❌ {file} NO ENCONTRADO")
return
# Intentar importar módulos
print("\n📦 Verificando imports:")
try:
from tool_manager import ToolManager
print(" ✅ tool_manager importado")
from language_selector import LanguageSelector
print(" ✅ language_selector importado")
except ImportError as e:
print(f" ❌ Error importando: {e}")
return
# Probar MiausticsMain
print("\n🎯 Probando MiausticsMain:")
try:
# Importar clase principal
sys.path.insert(0, os.getcwd())
# Verificar si existe el main.py completo
with open('main.py', 'r', encoding='utf-8') as f:
main_content = f.read()
if 'class MiausticsMain' in main_content:
print(" ✅ Clase MiausticsMain encontrada en main.py")
# Intentar instanciar
from main import MiausticsMain
app = MiausticsMain()
print(" ✅ MiausticsMain instanciado correctamente")
# Verificar que cargue las herramientas
print(f" 🔧 Tool manager: {type(app.tool_manager)}")
tools = app.tool_manager.discover_tools()
print(f" 📊 Herramientas encontradas: {len(tools)}")
for tool in tools:
print(f" • {tool.display_name}")
# Verificar menu_options
print(f" 📋 Opciones de menú: {len(app.menu_options)}")
for i, option in enumerate(app.menu_options):
print(f" {i+1}. {option}")
else:
print(" ❌ Clase MiausticsMain NO encontrada en main.py")
print(" ℹ️ Parece que el main.py está incompleto o corrupto")
except Exception as e:
print(f" ❌ Error probando MiausticsMain: {e}")
import traceback
traceback.print_exc()
print("\n" + "="*50)
print("💡 DIAGNÓSTICO:")
# Verificar translations
if os.path.exists('translations'):
eng_exists = os.path.exists('translations/english/main.json')
esp_exists = os.path.exists('translations/spanish/main.json')
print(f" 📁 Translations - English: {'✅' if eng_exists else '❌'}, Spanish: {'✅' if esp_exists else '❌'}")
else:
print(" ❌ Carpeta 'translations' no existe")
print("\n🚀 POSIBLES SOLUCIONES:")
print(" 1. Asegúrate de ejecutar desde la carpeta correcta")
print(" 2. Verifica que main.py esté completo")
print(" 3. Ejecuta: python setup.py (para crear archivos faltantes)")
print(" 4. Si sigue fallando, recrea el main.py desde los artifacts")
if __name__ == "__main__":
debug_main()