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, deckar01, docs@python, paul.j3
Date 2016-03-24.01:57:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Is this the kind of scenario that you have problems with?

    parser = argparse.ArgumentParser()
    sp = parser.add_subparsers(dest='cmd')
    p1 = sp.add_parser('cmd1')

    p2 = sp.add_parser('cmd2')

    p3 = sp.add_parser('cmd3', parents=[p1,p2],add_help=False, conflict_handler='resolve')

The problem is, apparently, that 'resolve' removes the '-h' option_string from the 1st subparser (but does not delete the whole action).  A kludgy fix is to add the '-h' back in (after p3 is created):


'p1._actions' is the list of actions (arguments) for subparser p1.  Usually help is the first action (if isn't in p3 because of the parents resolve action).

I may work out a custom conflict handler function, but for now this appears to solve the issue.  I don't know if the patch I proposed solves your issue or not.
Date User Action Args
2016-03-24 01:57:09paul.j3setrecipients: + paul.j3, bethard, docs@python, deckar01
2016-03-24 01:57:08paul.j3setmessageid: <>
2016-03-24 01:57:08paul.j3linkissue22401 messages
2016-03-24 01:57:07paul.j3create