What you get is an error message, not help (i.e. it is not created by yours -h).
isip_plot_det.py: error: too few arguments
. usage:
parser = ArgumentParser(usage = 'my custom usage line')
parser.print_usage()
astr = parser.format_usage()
. ββ
help help. call:
def __call__(self, parser, namespace, values, option_string=None):
parser.print_help()
parser.exit()
, parser.print_help(), . , -h. , , too few arguments unrecognized arguments ( ).
, ArgumentParser print_help. exit error.
print_help:
def print_help(self, file=None):
if file is None:
file = sys.stdout
self._print_message(self.format_help(), file)
format_help.
class MyParser(argparse.ArgumentParser):
def format_help(self):
return 'my custom help message\n second line\n\n'
:
In [104]: parser=MyParser(usage='custom usage')
In [105]: parser.parse_args(['-h'])
my custom help message
second line
...
In [106]: parser.parse_args(['unknown'])
usage: custom usage
ipython3: error: unrecognized arguments: unknown
...