Skip to content

Commit

Permalink
Fix parsing unknown arguments in config file
Browse files Browse the repository at this point in the history
  • Loading branch information
exquo committed Mar 28, 2021
1 parent 9955697 commit 09abe5b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scli
Original file line number Diff line number Diff line change
Expand Up @@ -3333,11 +3333,11 @@ def parse_cfg_file(parser, cli_args):
opt_val_flags = get_opt_val_flags(parser)
args_list = []
for arg_name, arg_val in cfg_f_args_dict.items():
try:
arg_default = parser.get_default(arg_name.replace('-', '_'))
except AttributeError:
logging.error("Error while parsing config file: unrecognized argument: %s", arg_name)
arg_dest = arg_name.replace('-', '_') # Assuming `dest` has not been overriden.
if arg_dest not in cli_args:
print("Error while parsing config file: unrecognized argument:", arg_name)
continue
arg_default = parser.get_default(arg_dest)
arg_name = '--' + arg_name
if isinstance(arg_default, bool):
if arg_val.lower() in ('true', 't', 'yes', 'y'):
Expand Down

0 comments on commit 09abe5b

Please sign in to comment.