From 72f3a2c4d9aeee52b4abe1b9525cafa32c06ec75 Mon Sep 17 00:00:00 2001 From: pengxiaopeng Date: Thu, 14 Mar 2024 16:47:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=9A=E8=BF=9B=E7=A8=8B?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E5=88=9B=E5=BB=BA=E5=90=8C=E4=B8=80=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=87=BA=E7=8E=B0=E7=AB=9E=E4=BA=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../python/ptdbg_ascend/common/file_check_util.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/file_check_util.py b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/file_check_util.py index 651ff5971a..61fc4ddf94 100644 --- a/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/file_check_util.py +++ b/debug/accuracy_tools/ptdbg_ascend/src/python/ptdbg_ascend/common/file_check_util.py @@ -300,13 +300,12 @@ def create_directory(dir_path): when invalid data throw exception """ dir_path = os.path.realpath(dir_path) - if not os.path.exists(dir_path): - try: - os.makedirs(dir_path, mode=FileCheckConst.DATA_DIR_AUTHORITY) - except OSError as ex: - print_error_log( - 'Failed to create {}.Please check the path permission or disk space .{}'.format(dir_path, str(ex))) - raise FileCheckException(FileCheckException.INVALID_PATH_ERROR) from ex + try: + os.makedirs(dir_path, mode=FileCheckConst.DATA_DIR_AUTHORITY, exist_ok=True) + except OSError as ex: + print_error_log( + 'Failed to create {}.Please check the path permission or disk space .{}'.format(dir_path, str(ex))) + raise FileCheckException(FileCheckException.INVALID_PATH_ERROR) from ex def change_mode(path, mode): -- Gitee