builtin help bug

I noticed a bug with the help for:


# python3 static_image_bounding_box.py --help

Traceback (most recent call last): File "static_image_bounding_box.py", line 90, in main() File "static_image_bounding_box.py", line 48, in main args = parser.parse_args(args) File "/usr/lib64/python3.7/argparse.py", line 1749, in parse_args args, argv = self.parse_known_args(args, namespace) File "/usr/lib64/python3.7/argparse.py", line 1781, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "/usr/lib64/python3.7/argparse.py", line 1987, in _parse_known_args start_index = consume_optional(start_index) File "/usr/lib64/python3.7/argparse.py", line 1927, in consume_optional take_action(action, args, option_string) File "/usr/lib64/python3.7/argparse.py", line 1855, in take_action action(self, namespace, argument_values, option_string) File "/usr/lib64/python3.7/argparse.py", line 1037, in __call__ parser.print_help() File "/usr/lib64/python3.7/argparse.py", line 2474, in print_help self._print_message(self.format_help(), file) File "/usr/lib64/python3.7/argparse.py", line 2458, in format_help return formatter.format_help() File "/usr/lib64/python3.7/argparse.py", line 284, in format_help help = self._root_section.format_help() File "/usr/lib64/python3.7/argparse.py", line 215, in format_help item_help = join([func(*args) for func, args in self.items]) File "/usr/lib64/python3.7/argparse.py", line 215, in item_help = join([func(*args) for func, args in self.items]) File "/usr/lib64/python3.7/argparse.py", line 322, in _format_usage action_usage = format(optionals + positionals, groups) File "/usr/lib64/python3.7/argparse.py", line 397, in _format_actions_usage start = actions.index(group._group_actions[0]) IndexError: list index out of range

If I comment out line 41:

#group = parser.add_mutually_exclusive_group()

I get the help documentation I would expect:

# python3 static_image_bounding_box.py --help
usage: static_image_bounding_box.py [-h] input_image [output_image]

Take an image and draw boxes around all the objects in the image.

positional arguments:
input_image image to load and perform inference on
output_image file to write result to

optional arguments:
-h, --help show this help message and exit
2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Thanks for the report, I will file an issue for tracking!

    Reply Like
    • Andrew
    • Developer
    • andrew_xnor
    • 7 mths ago
    • Reported - view

    Thanks for reporting the problem, this is indeed a bug. That line was left in from a previous version of the sample which took more arguments. It's no longer doing anything, and is evidently causing an error, so feel free to remove it!

    Reply Like
Like Follow
  • Status Fixed
  • 7 mths agoLast active
  • 2Replies
  • 20Views
  • 3 Following