This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author chris.jerdonek
Recipients bethard, chris.jerdonek
Date 2013-01-15.12:09:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1358251791.34.0.358251606196.issue16970@psf.upfronthosting.co.za>
In-reply-to
Content
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('foo', nargs='a')
  ...
  File ".../Lib/argparse.py", line 1333, in add_argument
    raise ValueError("length of metavar tuple does not match nargs")
ValueError: length of metavar tuple does not match nargs

The message should really be about nargs not having a valid value.  The nargs value is invalid regardless of the metavar.  There is also this:

>>> parser.add_argument('foo', nargs=-1)
_StoreAction(option_strings=[], dest='foo', nargs=-1, const=None, default=None, type=None, choices=None, help=None, metavar=None)

which is not consistent with this:

>>> parser.add_argument('foo', nargs=0)
  ...
    raise ValueError('nargs for store actions must be > 0; if you '
ValueError: nargs for store actions must be > 0; if you have nothing to store, actions such as store true or store const may be more appropriate
History
Date User Action Args
2013-01-15 12:09:51chris.jerdoneksetrecipients: + chris.jerdonek, bethard
2013-01-15 12:09:51chris.jerdoneksetmessageid: <1358251791.34.0.358251606196.issue16970@psf.upfronthosting.co.za>
2013-01-15 12:09:50chris.jerdoneklinkissue16970 messages
2013-01-15 12:09:50chris.jerdonekcreate