fix: 强制设置有效 locale 修复 vnpy_ctp CTP 登录崩溃
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,12 +6,13 @@ import os
|
||||
import socket
|
||||
import sys
|
||||
|
||||
os.environ.setdefault("LANG", "C.UTF-8")
|
||||
os.environ.setdefault("LC_ALL", "C.UTF-8")
|
||||
|
||||
BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, BASE)
|
||||
|
||||
from locale_fix import ensure_process_locale
|
||||
|
||||
ensure_process_locale()
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv(os.path.join(BASE, ".env"))
|
||||
@@ -38,6 +39,7 @@ def main() -> int:
|
||||
env = os.getenv("SIMNOW_ENV", "实盘")
|
||||
|
||||
print("=== SimNow 配置 ===")
|
||||
print(f"locale = {ensure_process_locale()}")
|
||||
print(f"SIMNOW_USER = {user or '(未设置)'}")
|
||||
print(f"SIMNOW_PASSWORD = {'*' * 8 if os.getenv('SIMNOW_PASSWORD') else '(未设置)'}")
|
||||
print(f"SIMNOW_TD = {td}")
|
||||
|
||||
Reference in New Issue
Block a user