Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #104656

argparse

Path csiph.com!aioe.org!.POSTED!not-for-mail
From Fillmore <fillmore_remove@hotmail.com>
Newsgroups comp.lang.python
Subject argparse
Date Fri, 11 Mar 2016 18:18:12 -0500
Organization Aioe.org NNTP Server
Lines 26
Message-ID <nbvjnl$7v7$1@gioia.aioe.org> (permalink)
NNTP-Posting-Host SxA1UDOcaYBihz5zYbn9yQ.user.gioia.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0
X-Notice Filtered by postfilter v. 0.8.2
X-Mozilla-News-Host news://nntp.aioe.org:119
Xref csiph.com comp.lang.python:104656

Show key headers only | View raw


Playing with ArgumentParser. I can't find a way to override the -h and 
--help options so that it provides my custom help message.

   -h, --help         show this help message and exit

Here is what I am trying:

parser = argparse.ArgumentParser("csresolver.py",add_help=False)
parser.add_argument("-h","--help",
                     help="USAGE: <STDIN> | myscript.py [-exf Exception 
File]")
parser.add_argument("-e","--ext", type=str,
                     help="Exception file")
args = parser.parse_args()


The result:

$ ./myscript.py -h
usage: myscript.py [-h HELP] [-e EXT]
csresolver.py: error: argument -h/--help: expected one argument

am I missing something obvious?

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

argparse Fillmore <fillmore_remove@hotmail.com> - 2016-03-11 18:18 -0500
  Re: argparse Fillmore <fillmore_remove@hotmail.com> - 2016-03-11 18:32 -0500
  Re: argparse "Sven R. Kunze" <srkunze@mail.de> - 2016-03-12 13:21 +0100

csiph-web