title: python parser read_file() AttributeError: 'NoneType' object has no attribute 'infile'
body: <pre><code>%%writefile testcipher.py
  import argparse
  def parse_command_line():
      parser=argparse.ArgumentParser()
      parser.add_argument("infile",type=argparse.FileType('r'),help="show this help message and exit")
      args=parser.parse_args()
  
  def read_file(file_path):
      with open(file_path,"r") as f:
          message=f.read()
      return message
  args = parse_command_line()
  read_file(args.infile)
  
  ----------
  
  %%bash
  
  python3 testcipher.py plain_message.txt
  
  
  ----------
  
  Traceback (most recent call last):
    File "testcipher.py", line 13, in &lt;module&gt;
      read_file(args.infile)
  AttributeError: 'NoneType' object has no attribute 'infile'
  </code></pre>
  
  <p>I tried to read file with parser argument, somehow it didnt work..help please..</p>
  
  <p>ignore for word requirement ignore for word requirement ignore for word requirement </p>