From fc7abf920810032fc874d99581ccd50f3b8d437d Mon Sep 17 00:00:00 2001 From: Yorusora <2944763079@qq.com> Date: Fri, 10 Jan 2025 15:17:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 ++-- Main_Quality_Relabel_GUI.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c561d5e..3eba565 100644 --- a/.gitignore +++ b/.gitignore @@ -253,7 +253,7 @@ ipython_config.py # Remove previous ipynb_checkpoints # git rm -r .ipynb_checkpoints/ data/* -history/* +logs/* .idea/* !./data -!./history \ No newline at end of file +!./logs \ No newline at end of file diff --git a/Main_Quality_Relabel_GUI.py b/Main_Quality_Relabel_GUI.py index 137ffee..0d14ba8 100644 --- a/Main_Quality_Relabel_GUI.py +++ b/Main_Quality_Relabel_GUI.py @@ -39,7 +39,9 @@ plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号 logger = logging.getLogger() logger.setLevel(logging.NOTSET) realtime = time.strftime('%Y%m%d', time.localtime(time.time())) -fh = logging.FileHandler(Path("history") / (realtime + ".log"), mode='a') +if not os.path.exists(Path("logs")): + os.makedirs(Path("logs")) +fh = logging.FileHandler(Path("logs") / (realtime + ".log"), mode='a') fh.setLevel(logging.NOTSET) fh.setFormatter(logging.Formatter("%(asctime)s: %(message)s")) logger.addHandler(fh)