Re: argparse csv + choices

2011-03-31 Thread Neal Becker
Robert Kern wrote: > On 3/30/11 10:32 AM, Neal Becker wrote: >> I'm trying to combine 'choices' with a comma-seperated list of options, so I >> could do e.g., >> >> --cheat=a,b >> >> parser.add_argument ('--cheat', choices=('a','b','c'), type=lambda x: >> x.split(','), default=[]) >> >> test.

Re: argparse csv + choices

2011-03-30 Thread Robert Kern
On 3/30/11 10:32 AM, Neal Becker wrote: I'm trying to combine 'choices' with a comma-seperated list of options, so I could do e.g., --cheat=a,b parser.add_argument ('--cheat', choices=('a','b','c'), type=lambda x: x.split(','), default=[]) test.py --cheat a error: argument --cheat: inva

argparse csv + choices

2011-03-30 Thread Neal Becker
I'm trying to combine 'choices' with a comma-seperated list of options, so I could do e.g., --cheat=a,b parser.add_argument ('--cheat', choices=('a','b','c'), type=lambda x: x.split(','), default=[]) test.py --cheat a error: argument --cheat: invalid choice: ['a'] (choose from 'a', 'b',