Skip to content

Broken help message + fix #10

@ZoyavanMeel

Description

@ZoyavanMeel

Hi, I am using SWAMPy currently and found out that the help message is broken.

python simulate_metagenome.py --help

Argparse will give an AssertionError on parser.parse_args() (line 114) when running this (pasted below for completeness). It seems this is caused by having (too many?) metavar='' when adding arguments to the parser. When removing all cases of this, the help message prints just fine. The error also occurs for the Docker image.

Traceback (most recent call last):
  File "/home/src/simulate_metagenome.py", line 350, in <module>
    load_command_line_args()
  File "/home/src/simulate_metagenome.py", line 114, in load_command_line_args
    args = parser.parse_args()
  File "/usr/lib/python3.8/argparse.py", line 1780, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python3.8/argparse.py", line 1812, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.8/argparse.py", line 2018, in _parse_known_args
    start_index = consume_optional(start_index)
  File "/usr/lib/python3.8/argparse.py", line 1958, in consume_optional
    take_action(action, args, option_string)
  File "/usr/lib/python3.8/argparse.py", line 1886, in take_action
    action(self, namespace, argument_values, option_string)
  File "/usr/lib/python3.8/argparse.py", line 1056, in __call__
    parser.print_help()
  File "/usr/lib/python3.8/argparse.py", line 2506, in print_help
    self._print_message(self.format_help(), file)
  File "/usr/lib/python3.8/argparse.py", line 2490, in format_help
    return formatter.format_help()
  File "/usr/lib/python3.8/argparse.py", line 294, in format_help
    help = self._root_section.format_help()
  File "/usr/lib/python3.8/argparse.py", line 225, in format_help
    item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib/python3.8/argparse.py", line 225, in <listcomp>
    item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib/python3.8/argparse.py", line 349, in _format_usage
    assert ' '.join(opt_parts) == opt_usage
AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions