From 30af2f297f4e412bac36c9678bb68ffb2f4c0709 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期一, 17 六月 2024 15:01:27 +0800
Subject: [PATCH] 文件读取bug修复

---
 log_module/log_export.py |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/log_module/log_export.py b/log_module/log_export.py
index a45f3ac..ef27b57 100644
--- a/log_module/log_export.py
+++ b/log_module/log_export.py
@@ -82,8 +82,8 @@
         date = tool.get_now_date_str()
     try:
         with open("{}/logs/gp/l2/l2_data.{}.log".format(constant.get_path_prefix(), date), mode='r') as f:
-            while True:
-                data = f.readline()
+            lines = f.readlines()
+            for data in lines:
                 if not data:
                     break
                 index = data.find(' - ') + 2
@@ -127,8 +127,8 @@
     try:
         with open(path_, mode='r',
                   encoding="utf-8") as f:
-            while True:
-                line = f.readline()
+            lines = f.readlines()
+            for line in lines:
                 if not line:
                     break
                 if line.find("code:{}".format(code)) < 0:
@@ -154,8 +154,8 @@
     with open("{}/logs/gp/l2/l2_trade.{}.log".format(constant.get_path_prefix(), date), mode='r',
               encoding="utf-8") as f:
         latest_single = [None, None]
-        while True:
-            line = f.readline()
+        lines = f.readlines()
+        for line in lines:
             if not line:
                 break
             if line.find("code={}".format(code)) < 0:
@@ -201,8 +201,8 @@
     pos_list = []
     with open("{}/logs/gp/l2/l2_real_place_order_position.{}.log".format(constant.get_path_prefix(), date), mode='r',
               encoding="utf-8") as f:
-        while True:
-            line = f.readline()
+        lines = f.readlines()
+        for line in lines:
             if not line:
                 break
             if line.find("{}-".format(code)) < 0:
@@ -305,8 +305,8 @@
     msg_list = []
     if os.path.exists(path_str):
         with open(path_str, mode='r', encoding="utf-8") as f:
-            while True:
-                line = f.readline()
+            lines = f.readlines()
+            for line in lines:
                 if not line:
                     break
                 msg_list.append(line)

--
Gitblit v1.8.0