| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import pandas as pd
- import sys
- import os
- # 添加当前目录到路径
- sys.path.append(os.path.dirname(os.path.abspath(__file__)))
- from config_manager import ConfigManagerGUI
- def debug_weapon_parsing():
- # 创建配置管理器实例
- manager = ConfigManagerGUI()
-
- # 读取Excel文件
- file_path = '方块武器配置/方块武器配置表.xlsx'
- print(f"正在读取文件: {file_path}")
-
- try:
- # 读取所有工作表
- xl = pd.ExcelFile(file_path)
- all_sheets_data = {}
-
- for sheet_name in xl.sheet_names:
- print(f"\n读取工作表: {sheet_name}")
- df = pd.read_excel(file_path, sheet_name=sheet_name)
- all_sheets_data[sheet_name] = df
- print(f"工作表 {sheet_name} 形状: {df.shape}")
- print(f"列名: {list(df.columns)}")
-
- # 调用武器解析方法
- print("\n=== 开始解析武器配置 ===")
- result = manager.parse_weapon_multi_sheet_data(all_sheets_data, '方块武器配置表.xlsx')
-
- print(f"\n解析结果:")
- print(f"武器数量: {len(result.get('weapons', []))}")
-
- if result.get('weapons'):
- print("\n前3个武器配置:")
- for i, weapon in enumerate(result['weapons'][:3]):
- print(f"武器 {i+1}: {weapon}")
- else:
- print("没有解析到任何武器配置")
-
- except Exception as e:
- print(f"解析过程中出现错误: {e}")
- import traceback
- traceback.print_exc()
- if __name__ == "__main__":
- debug_weapon_parsing()
|