title: How can I use python's argparse with a predefined argument string?
body: <p>I want to use the pythons argparse module to parse my cli parameter string. This works for the parameters a pass from terminal, but not with a given string.</p>
  
  <pre><code>import argparse
  
  parser = argparse.ArgumentParser(description='Argparse Test script')
  parser.add_argument("param", help='some parameter')
  
  argString = 'someTestFile'
  print(argString)
  
  args = parser.parse_args(argString)
  </code></pre>
  
  <p>If I run this script I get this output:</p>
  
  <pre><code>~/someTestFile
  usage: argparsetest.py [-h] param
  argparsetest.py: error: unrecognized arguments: o m e T e s t F i l e
  </code></pre>
  
  <p>The <code>~/someTestFile</code> is somehow transformed in <code>o m e T e s t F i l e</code>. As already mentioned, it works if I pass the filename from the terminal.</p>
  
  <p>I could imagine, that this has something to do with string encodings. Does someone has an idea how to fix this?</p>