From a0f55895d1f04c379b39d244c4747a55f21c98c9 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 14 May 2023 23:49:24 +0800 Subject: [PATCH] fix logging mkdir --- Difficult_Rocket/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Difficult_Rocket/main.py b/Difficult_Rocket/main.py index 383117c..89963b1 100644 --- a/Difficult_Rocket/main.py +++ b/Difficult_Rocket/main.py @@ -85,10 +85,10 @@ class Game(Options): def init_logger(self) -> None: log_path = self.logging_config['handlers']['file']['filename'] - log_path = Path(f"logs/{log_path.format(time.strftime('%Y-%m-%d %H-%M-%S' , time.gmtime(DR_runtime.start_time_ns / 1000_000_000)))}") + log_path = f"logs/{log_path.format(time.strftime('%Y-%m-%d %H-%M-%S' , time.gmtime(DR_runtime.start_time_ns / 1000_000_000)))}" mkdir = False - if not Path("logs/").exists(): - log_path.mkdir(parents=True) + if not Path('logs/').is_dir(): + Path('logs/').mkdir() mkdir = True self.logging_config['handlers']['file']['filename'] = str(log_path.absolute()) logging.config.dictConfig(self.logging_config)