title: Printing the command line arguments in python
body: <p>I am learning to pass command line arguments in python. I want to print the argument but I keep on getting the following error:</p>
  <p>AttributeError: 'dict' object has no attribute 'fft_length'</p>
  <p>My code is as follows:</p>
  <pre><code>import argparse
  import configlib
  
  parser = configlib.add_parser(&quot;MFCC config&quot;)
  
  parser.add_argument(&quot;-fft&quot;,&quot;--fft_length&quot;, type=int, default=512, metavar=&quot;&quot;, help=&quot;FFT length&quot;)
  args = configlib.parse()
  
  print(args.fft_length)
  </code></pre>
  <p>The code for configlib is as follows:</p>
  <pre><code>from typing import Dict, Any
  import logging
  import pprint
  import sys
  import argparse
  
  # Logging for config library
  logger = logging.getLogger(__name__)
  
  # Our global parser that we will collect arguments into
  parser = argparse.ArgumentParser(description=__doc__, fromfile_prefix_chars=&quot;@&quot;)
  
  # Global configuration dictionary that will contain parsed arguments
  # It is also this variable that modules use to access parsed arguments
  config: Dict[str, Any] = {}
  
  
  def add_parser(title: str, description: str = &quot;&quot;):
      &quot;&quot;&quot;Create a new context for arguments and return a handle.&quot;&quot;&quot;
      return parser.add_argument_group(title, description)
  
  
  def parse(save_fname: str = &quot;&quot;) -&gt; Dict[str, Any]:
      &quot;&quot;&quot;Parse given arguments.&quot;&quot;&quot;
      config.update(vars(parser.parse_args()))
      logging.info(&quot;Parsed %i arguments.&quot;, len(config))
      # Optionally save passed arguments
      if save_fname:
          with open(save_fname, &quot;w&quot;) as fout:
              fout.write(&quot;\n&quot;.join(sys.argv[1:]))
          logging.info(&quot;Saving arguments to %s.&quot;, save_fname)
      return config
  
  
  def print_config():
      &quot;&quot;&quot;Print the current config to stdout.&quot;&quot;&quot;
      pprint.pprint(config)
  </code></pre>
  <p>Can you please help me to understand what am I doing wrong?</p>