alexanderrichards / ProductionSystem

MIT License
0 stars 1 forks source link

Config fix #44

Closed alexanderrichards closed 5 years ago

alexanderrichards commented 5 years ago

Used to do final step in config setup of overlaying command line args on top of config file ones as below:

args = parser.parse_args(namespace=argparse.Namespace(**arg_dict))

However: This doesn't work in 2.7.13 but does in 2.7.5. A change was made to pass a blank namespace to the subparsers, in order to pick up any modified defaults. This breaks the logic of our code. Will have to use the subparser directly and cut out the subcommand from the args to parse as below:

args = subparser.choices[arg_dict['subcommand']]
                .parse_args(sys.argv[2:], namespace=argparse.Namespace(**arg_dict))