Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for custom config file command line argument TypeError bug #93

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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