This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.j3
Recipients bethard, eric.araujo, jakub, paul.j3, tshepang
Date 2013-09-28.06:32:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1380349955.82.0.292203483103.issue14365@psf.upfronthosting.co.za>
In-reply-to
Content
I think the correction to the problem that I noted in the previous post is to return 'None, arg_string, None', rather than 'action, arg_string, None' in the case where the action is found in a subparser.

This is what '_parse_optional' does at the end:

        # it was meant to be an optional but there is no such option
        # in this parser (though it might be a valid option in a subparser)
        return None, arg_string, None

An input like '--foo baz' would then produce an 'invalid choice' error.  Since '--foo' is an optional that the primary parser does not recognize, 'baz' in interpreted as a positional, in this case an invalid subparser choice.

I'm working on cleaning up a test script.
History
Date User Action Args
2013-09-28 06:32:35paul.j3setrecipients: + paul.j3, bethard, eric.araujo, tshepang, jakub
2013-09-28 06:32:35paul.j3setmessageid: <1380349955.82.0.292203483103.issue14365@psf.upfronthosting.co.za>
2013-09-28 06:32:35paul.j3linkissue14365 messages
2013-09-28 06:32:35paul.j3create