Skip to content

Instantly share code, notes, and snippets.

@zzzeek
Created February 10, 2013 16:04
Show Gist options
  • Save zzzeek/4750029 to your computer and use it in GitHub Desktop.
Save zzzeek/4750029 to your computer and use it in GitHub Desktop.
from argparse import ArgumentParser
parser = ArgumentParser(prog='test')
subparsers = parser.add_subparsers()
subparser = subparsers.add_parser("foo", help="run foo")
parser.parse_args()
@zzzeek
Copy link
Author

zzzeek commented Feb 10, 2013

the output should be (assuming you name it "test.py"):

$ python3 test.py
usage: test [-h] {foo} ...
test: error: too few arguments

@niwinz
Copy link

niwinz commented Feb 10, 2013

My output is.. nothink.

(test)[3/5.0.2]niwi@localhost:/tmp> cat test.py 
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
parser = ArgumentParser(prog='test')
subparsers = parser.add_subparsers()
subparser = subparsers.add_parser("foo", help="run foo")
parser.parse_args()
(test)[3/5.0.2]niwi@localhost:/tmp> python3.3 test.py 
(test)[3/5.0.2]niwi@localhost:/tmp> 

@zzzeek
Copy link
Author

zzzeek commented Feb 10, 2013

the behavior entirely changed from python 3.2 to python 3.3. well great.

@JustinAzoff
Copy link

Found the commit that broke it (using git bisect, because hg bisect was being unhelpful):

commit 688e1afe723cbcd7e92912765a2f0a3e133b734d
Author: R David Murray <rdmurray@bitdance.com>
Date:   Thu Jun 9 12:34:07 2011 -0400

    #10424: argument names are now included in the missing argument message

    Fix and initial test patch by Michele Orrù.

which corresponds to changeset: 70741:cab204a79e09

http://hg.python.org/cpython/rev/cab204a79e09

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment