Closed GoogleCodeExporter closed 9 years ago
You're getting that error because your 'foo' argument is required, not
optional. If
you want it to be optional, you need to do something like:
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> parser.add_argument('foo', nargs='?', choices='abc', default='a')
>>> parser.parse_args([])
Namespace(foo='a')
Original comment by steven.b...@gmail.com
on 31 Jan 2010 at 10:38
Original comment by steven.b...@gmail.com
on 28 Feb 2010 at 10:11
Original issue reported on code.google.com by
fperez....@gmail.com
on 15 Jan 2010 at 1:01