title: Suppressing argparse Error message - Python
body: <p>I'm using argparse to parse command line arguments. However at this time, I have an unusual request: I want to suppress the error message. For example:</p>
  
  <pre><code> # !/usr/bin/env python
   try:
          parser = argparse.ArgumentParser(description='Parse')
          parser.add_argument('url', metavar='URL', type=str, nargs='+', 
                              help='Specify URL')
   except:
          print("Invalid arguments or number of arguments")
          exit(2)
  </code></pre>
  
  <p>so I only expect that to print <code>"Invalid arguments or number of arguments"</code> and nothing else. However, then I execute the code for example:</p>
  
  <pre><code>./foo --BOGUS
  </code></pre>
  
  <p>I'm getting the full usage message:</p>
  
  <pre><code>usage: foo [-h]
  foo: error: too few arguments
  foo: Invalid arguments or number of arguments 
  </code></pre>
  
  <p>How can I achieve that? </p>