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 MaT1g3R
Recipients MaT1g3R
Date 2018-02-18.05:06:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1518930403.05.0.467229070634.issue32867@psf.upfronthosting.co.za>
In-reply-to
Content
If I run this script with -h
-----8<------------------
from argparse import ArgumentParser
mapping = ['123456', '12345', '12345', '123']
p = ArgumentParser('11111111111111')
p.add_argument('-v', '--verbose', help='verbose mode', action='store_true')
p.add_argument('targets', help='installation targets',  nargs='+', metavar='\n'.join(mapping))
p.parse_args()
---------8<--------------------
I get an error:
---------8<--------------------
Traceback (most recent call last):
  File "tmp.py", line 7, in <module>
    p.parse_args()
  File "/usr/lib/python3.6/argparse.py", line 1730, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python3.6/argparse.py", line 1762, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.6/argparse.py", line 1968, in _parse_known_args
    start_index = consume_optional(start_index)
  File "/usr/lib/python3.6/argparse.py", line 1908, in consume_optional
    take_action(action, args, option_string)
  File "/usr/lib/python3.6/argparse.py", line 1836, in take_action
    action(self, namespace, argument_values, option_string)
  File "/usr/lib/python3.6/argparse.py", line 1020, in __call__
    parser.print_help()
  File "/usr/lib/python3.6/argparse.py", line 2362, in print_help
    self._print_message(self.format_help(), file)
  File "/usr/lib/python3.6/argparse.py", line 2346, in format_help
    return formatter.format_help()
  File "/usr/lib/python3.6/argparse.py", line 282, in format_help
    help = self._root_section.format_help()
  File "/usr/lib/python3.6/argparse.py", line 213, in format_help
    item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib/python3.6/argparse.py", line 213, in <listcomp>
    item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib/python3.6/argparse.py", line 334, in _format_usage
    assert ' '.join(pos_parts) == pos_usage
AssertionError
-----8<------------------
History
Date User Action Args
2018-02-18 05:06:43MaT1g3Rsetrecipients: + MaT1g3R
2018-02-18 05:06:43MaT1g3Rsetmessageid: <1518930403.05.0.467229070634.issue32867@psf.upfronthosting.co.za>
2018-02-18 05:06:42MaT1g3Rlinkissue32867 messages
2018-02-18 05:06:41MaT1g3Rcreate