Skip to content

Commit

Permalink
Merge pull request #93 from SysError956/MUMC-Latest
Browse files Browse the repository at this point in the history
Fix for custom config file command line argument TypeError bug
  • Loading branch information
terrelsa13 authored Nov 5, 2023
2 parents 7509dab + 69ef857 commit 11535a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions mumc_modules/mumc_config_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion mumc_modules/mumc_parse_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 11535a1

Please sign in to comment.