From c2cb13e61e6ff8f852ab8894e686771b2cc2b3b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=B5=E6=9B=A6?= Date: Sat, 14 Jun 2025 22:51:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=88=A0=E9=99=A4=E5=A4=B1=E8=B4=A5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xiaomusic/xiaomusic.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xiaomusic/xiaomusic.py b/xiaomusic/xiaomusic.py index db01ecf..29f19c8 100644 --- a/xiaomusic/xiaomusic.py +++ b/xiaomusic/xiaomusic.py @@ -171,7 +171,10 @@ class XiaoMusic: if log_path and not os.path.exists(log_path): os.makedirs(log_path) if os.path.exists(log_file): - os.remove(log_file) + try: + os.remove(log_file) + except Exception as e: + self.log.warning(f"无法删除旧日志文件: {log_file} {e}") handler = RotatingFileHandler( self.config.log_file, maxBytes=10 * 1024 * 1024,