45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
测试模块导入
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
|
|
# 修复编码问题
|
|
os.environ['PYTHONIOENCODING'] = 'utf-8'
|
|
|
|
# 添加当前目录到路径
|
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
sys.path.insert(0, current_dir)
|
|
|
|
print(f"Current Directory: {current_dir}")
|
|
print(f"Python Path: {sys.path[:3]}")
|
|
|
|
try:
|
|
import strategy_base
|
|
print("Success: strategy_base imported successfully")
|
|
print(f"Strategy Base Class: {strategy_base.StrategyBase}")
|
|
except Exception as e:
|
|
print(f"Error: strategy_base import failed: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
try:
|
|
import ma_cross_strategy
|
|
print("Success: ma_cross_strategy imported successfully")
|
|
except Exception as e:
|
|
print(f"Error: ma_cross_strategy import failed: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
try:
|
|
import backtest_engine
|
|
print("Success: backtest_engine imported successfully")
|
|
except Exception as e:
|
|
print(f"Error: backtest_engine import failed: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|