title: TypeError: __init__() got an unexpected keyword argument 'type' in argparse
body: <p>Hey so I'm using argparse to try and generate a quarterly report. This is what the code looks like:</p>
  
  <pre><code>parser  = argparse.ArgumentParser()
  
  parser.add_argument('-q', "--quarter",  action='store_true', type=int, help="Enter a Quarter number: 1,2,3, or 4 ")
  parser.add_argument('-y', "--year", action='store_true',type=str,help="Enter a year in the format YYYY ")
  args = parser.parse_args()
  </code></pre>
  
  <p>the error I receive is: </p>
  
  <blockquote>
    <p>TypeError: <strong>init</strong>() got an unexpected keyword argument 'type'  </p>
  </blockquote>
  
  <p>as far as I can tell from the argparse documentation type is one of the parameters of the add_argument function. I tried removing this and updating the code to :</p>
  
  <pre><code>parser  = argparse.ArgumentParser()
  
  parser.add_argument('-q', "--quarter",  action='store_true', help="Enter a Quarter number: 1,2,3, or 4 ")
  parser.add_argument('-y', "--year", action='store_true',help="Enter a year in the format YYYY ")
  args = parser.parse_args()
  </code></pre>
  
  <p>I then tried to run it with: <code>python scriptname.py -q 1 -y 2015</code> and it is giving me the following error:</p>
  
  <blockquote>
    <p>error:unrecognized arguments: 1 2015 </p>
  </blockquote>
  
  <p>I don't know why that is either. Can anyone please shed some light on this.   </p>