From 69ef8573505642102d83b2ac22068b9cf751986f Mon Sep 17 00:00:00 2001 From: SysError956 Date: Sat, 4 Nov 2023 14:26:21 -0400 Subject: [PATCH] Converted alt config path from str to Path --- mumc_modules/mumc_config_import.py | 4 ++-- mumc_modules/mumc_parse_options.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mumc_modules/mumc_config_import.py b/mumc_modules/mumc_config_import.py index 267c0a8..bc9323b 100755 --- a/mumc_modules/mumc_config_import.py +++ b/mumc_modules/mumc_config_import.py @@ -51,8 +51,8 @@ def importConfig(init_dict,cmdopt_dict): add_to_PATH(cmdopt_dict['altConfigPath'],0) #check if yaml config - if ((getFileExtension(cmdopt_dict['altConfigPath'] + '/' + cmdopt_dict['altConfigFileExt']) == '.yaml') or - (getFileExtension(cmdopt_dict['altConfigPath'] + '/' + cmdopt_dict['altConfigFileExt']) == '.yml')): + if ((getFileExtension(cmdopt_dict['altConfigPath'] / cmdopt_dict['altConfigFileExt']) == '.yaml') or + (getFileExtension(cmdopt_dict['altConfigPath'] / cmdopt_dict['altConfigFileExt']) == '.yml')): #open alternate yaml config with open(cmdopt_dict['altConfigPath'] / cmdopt_dict['altConfigFileExt'], 'r') as mumc_config_yaml: cfg = yaml.safe_load(mumc_config_yaml) diff --git a/mumc_modules/mumc_parse_options.py b/mumc_modules/mumc_parse_options.py index ce95dc7..372bfcb 100755 --- a/mumc_modules/mumc_parse_options.py +++ b/mumc_modules/mumc_parse_options.py @@ -3,6 +3,7 @@ from mumc_modules.mumc_console_info import default_helper_menu,print_full_help_menu,missing_config_argument_helper,missing_config_argument_format_helper,alt_config_file_does_not_exists_helper,alt_config_syntax_helper,unknown_command_line_option_helper from mumc_modules.mumc_output import getFullPathName,getFileExtension from mumc_modules.mumc_console_attributes import console_text_attributes +from pathlib import Path #define custom exception class CMDOptionIndexError(Exception): @@ -128,7 +129,7 @@ def parseAltConfigPathFileSyntax(argv,altConfigInfo,cmdOption,moduleExtension,th ((os.path.basename(os.path.splitext(argv[argv.index(cmdOption)+1])[0])).count(".") == 0) and ((os.path.basename(os.path.splitext(argv[argv.index(cmdOption)+1])[0])).count(" ") == 0)): #Get path without file.name - altConfigPath=os.path.dirname(argv[argv.index(cmdOption)+1]) + altConfigPath=Path(os.path.dirname(argv[argv.index(cmdOption)+1])) #Get file without extension altConfigFileNoExt=os.path.basename(os.path.splitext(argv[argv.index(cmdOption)+1])[0]) else: