title: Understanding Python 3 argparse() on Windows
body: <p>I'm obviously in need of help with argparse.  From the <a href="https://docs.python.org/3.4/library/argparse.html" rel="nofollow">3.4 manual</a>, if I type</p>
  
  <pre><code>import argparse
  parser = argparse.ArgumentParser(prog='PROG')
  parser.add_argument('-f', '--foo')
  parser.add_argument('bar')
  parser.parse_args()
  </code></pre>
  
  <p>on the command line, having saved this code into test.py and then run </p>
  
  <pre><code>test.py bar
  </code></pre>
  
  <p>I as expecting my prompt back, but I get</p>
  
  <pre><code>usage: PROG [-h] [-f FOO] bar
  PROG: error: the following arguments are required: bar
  </code></pre>
  
  <p>What have I got to do to make test.py accept a non-optional argument?
  Incidentally, I'm running this on Windows 8.1, and when I run the same code on my Mac, I get my prompt back with no script output as expected.  That means it's something to do with windows. </p>
  
  <p>EDIT: I can try this in an interactive session and it also fails to operate correctly.</p>
  
  <p>EDIT: Yes - sys.argv is not having the arguments appended to it.  I think it's something to do with the file association.  On install, Parallels uses Python's Python Launcher which mean it tried to run the script on my Mac host.  I edited the association to the local python binary, but now this.  I've tried hacking the registry to help, but it was already set correctly to <code>"c:\windows\py.exe" "%1" %*</code></p>