From 4ab857aa892499fedce46f94fc2d8d2a91f4314f Mon Sep 17 00:00:00 2001
From: log
Date: Fri, 10 Jul 2026 12:13:54 +0800
Subject: [PATCH] fix: select latest complete market cross-section

---
 scripts/push_monitor.py |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/scripts/push_monitor.py b/scripts/push_monitor.py
index b64930f..0229724 100755
--- a/scripts/push_monitor.py
+++ b/scripts/push_monitor.py
@@ -6,13 +6,19 @@
 
 import sys
 import os
-sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+# 确保可以找到同目录的模块
+script_dir = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, script_dir)
+project_root = os.path.dirname(script_dir)
+sys.path.insert(0, project_root)
 
 from datetime import datetime
 import logging
 import json
 import time
 import subprocess
+
 from is_trading_day import TradingDayChecker
 
 # 配置日志
@@ -32,6 +38,9 @@
 
     def __init__(self):
         """初始化监控器"""
+        # 切换到项目根目录
+        os.chdir(project_root)
+
         self.today = datetime.now().strftime('%Y-%m-%d')
         self.trading_checker = TradingDayChecker()
 
@@ -101,7 +110,7 @@
 
         try:
             # 使用subprocess调用auto_push_system.py
-            script_path = os.path.join(os.path.dirname(__file__), 'auto_push_system.py')
+            script_path = os.path.join(script_dir, 'auto_push_system.py')
             cmd = [sys.executable, script_path]
 
             logger.info(f"执行命令: {' '.join(cmd)}")
@@ -210,7 +219,7 @@
             logger.warning("⚠️ 飞书配置不存在,推送可能失败")
 
         # 检查脚本
-        script_path = os.path.join(os.path.dirname(__file__), 'auto_push_system.py')
+        script_path = os.path.join(script_dir, 'auto_push_system.py')
         if os.path.exists(script_path):
             checks['script_exists'] = True
             logger.info("✓ 自动推送脚本存在")

--
Gitblit v1.8.0