Steven Bethard <steven.beth...@gmail.com> added the comment:

Sorry, typo. Should have been len(sys.argv) == 1. Full script:

import argparse
import sys

parser = argparse.ArgumentParser()
parser.add_argument('--foo')

if len(sys.argv) == 1:
    parser.print_help()  
else:
    print(parser.parse_args())

With that script, I see:

$ ./python.exe temp.py 
usage: temp.py [-h] [--foo FOO]

optional arguments:
  -h, --help  show this help message and exit
  --foo FOO

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9653>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to