From 10315c8269f5708285a1f4c70c38a2fcc3da423a Mon Sep 17 00:00:00 2001 From: mayun110 Date: Tue, 15 Aug 2023 12:01:46 +0800 Subject: [PATCH] =?UTF-8?q?fix=E6=97=A5=E5=BF=97=20=E5=9C=A8windows?= =?UTF-8?q?=E4=B8=8B=E6=97=A0=E6=B3=95=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/endpoints/system.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/endpoints/system.py b/app/api/endpoints/system.py index 4272ee51..93480b8e 100644 --- a/app/api/endpoints/system.py +++ b/app/api/endpoints/system.py @@ -112,11 +112,11 @@ def get_logging(token: str): def log_generator(): log_path = settings.LOG_PATH / 'moviepilot.log' # 读取文件末尾50行,不使用tailer模块 - with open(log_path, 'r') as f: + with open(log_path, 'r', encoding='utf-8') as f: for line in f.readlines()[-50:]: yield 'data: %s\n\n' % line while True: - for text in tailer.follow(open(log_path, 'r')): + for text in tailer.follow(open(log_path, 'r', encoding='utf-8')): yield 'data: %s\n\n' % (text or '') time.sleep(1)