From d9ea1f304e9346aa2f04a58ecbdf8e6bfb729843 Mon Sep 17 00:00:00 2001 From: brf153 <153hsb@gmail.com> Date: Mon, 5 Aug 2024 13:51:16 +0530 Subject: [PATCH 1/2] fix process_log_dir_replacements function in kai_logging.py Signed-off-by: brf153 <153hsb@gmail.com> --- kai/kai_logging.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kai/kai_logging.py b/kai/kai_logging.py index 2476b5b5..cc274f9c 100644 --- a/kai/kai_logging.py +++ b/kai/kai_logging.py @@ -11,15 +11,16 @@ ) -def process_log_dir_replacements(log_dir: str): +def process_log_dir_replacements(log_dir: str) -> str: ## # We want to replace $pwd with the location of the Kai project directory, # this is needed to help with specifying from configuration ## if log_dir.startswith("$pwd"): - log_dir = log_dir.replace( - "$pwd", os.path.join(os.path.dirname(os.path.realpath(__file__)), "../") - ) + current_directory = os.getcwd() + kai_project_directory = os.path.abspath(os.path.join(current_directory, "..")) + log_dir = log_dir.replace("$pwd", kai_project_directory, 1) + log_dir = os.path.normpath(log_dir) return log_dir From 8097c848de2c687751359249f3411ef5d2628bc4 Mon Sep 17 00:00:00 2001 From: brf153 <153hsb@gmail.com> Date: Wed, 7 Aug 2024 21:20:04 +0530 Subject: [PATCH 2/2] correct kai_project_directory Signed-off-by: brf153 <153hsb@gmail.com> --- kai/kai_logging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kai/kai_logging.py b/kai/kai_logging.py index cc274f9c..2b79d0ea 100644 --- a/kai/kai_logging.py +++ b/kai/kai_logging.py @@ -18,7 +18,7 @@ def process_log_dir_replacements(log_dir: str) -> str: ## if log_dir.startswith("$pwd"): current_directory = os.getcwd() - kai_project_directory = os.path.abspath(os.path.join(current_directory, "..")) + kai_project_directory = os.path.abspath(current_directory) log_dir = log_dir.replace("$pwd", kai_project_directory, 1) log_dir = os.path.normpath(log_dir) return log_dir