>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('choices', nargs='*', default=['a'], choices=['a', 'b', 'c'])
>>> parser.parse_args()
usage: [-h] [{a,b,c} [{a,b,c} ...]]
: error: argument choices: invalid choice: ['a'] (choose from 'a', 'b', 'c')
Yeah, this is a bad interaction between choices and nargs='*'. When
you have a chance, please file a bug report at bugs.python.org, so
this doesn't get lost. In the meantime, a workaround is to pass a
type= argument instead with something like:
def my_type(string):
if string not in ['a', 'b', 'c']:
raise TypeError
return string
Steve
--
Where did you get that preposterous hypothesis?
Did Steve tell you that?
--- The Hiphopopotamus