ConfigArgParse icon indicating copy to clipboard operation
ConfigArgParse copied to clipboard

allow for choices to be empty in config file but not on command line

Open mathisloevenich opened this issue 4 years ago • 5 comments

A config file like:

values = []

resolves in: values=['']

it's unpleasent to have this empyt string. Instead it should be possible to just get an empty list.

mathisloevenich avatar Oct 29 '21 09:10 mathisloevenich

If you work with choices, it will mess up the code. A workaround for this is to add an empty string to choices

choices.append([''])

mathisloevenich avatar Oct 29 '21 09:10 mathisloevenich

If there is no particular reason for this behaviour it would be nice to fix this, even if it's not necessarily a bug.

mathisloevenich avatar Oct 29 '21 09:10 mathisloevenich

With the new version 1.5.3 this is no longer working. It worked on 1.2.3

mathisloevenich avatar Oct 31 '21 11:10 mathisloevenich

We can simply fix this with nargs="*", but obviously this would allow to have flags with no effects

mathisloevenich avatar Oct 31 '21 11:10 mathisloevenich

This is an issue with environment variables too.

VALUES= python mytest.py will set the corresponding arg to [''], overriding the default value. This is generally not what we want.

If the env var VALUES is undefined it works as expected and the default value is used for that arg.

carlfischerjba avatar Jul 28 '22 11:07 carlfischerjba