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 paul.j3, porton
Date 2018-07-23.16:16:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1532362597.92.0.56676864532.issue34191@psf.upfronthosting.co.za>
In-reply-to
Content
Your code runs fine under 3.6.5.

But if I add 'subparsers.required=True', I get your error.  It's having problems formatting the name of the subparsers command when issuing the error message.

If I add a 'dest' to the add_subparsers I get the expected error message:

    import argparse

    parser = argparse.ArgumentParser(description="Automatically process XML")
    subparsers = parser.add_subparsers(title='subcommands', dest='cmd')
    subparsers.required=True
    chain_parser = subparsers.add_parser('chain', aliases=['c'], 
        help='Automatically run a chain of transformations')

    args = parser.parse_args()
    print(args)

The default 'dest' for subparsers is None, and the error arises from

    ','.join([None])

The problems with a missing 'dest' came up in earlier discussions about making required/not required subparsers.  3.7 made subparsers 'required' by default, but it appears that it hasn't addressed this missing 'dest' problem.

But I haven't followed the latest release details closely.
History
Date User Action Args
2018-07-23 16:16:37paul.j3setrecipients: + paul.j3, porton
2018-07-23 16:16:37paul.j3setmessageid: <1532362597.92.0.56676864532.issue34191@psf.upfronthosting.co.za>
2018-07-23 16:16:37paul.j3linkissue34191 messages
2018-07-23 16:16:37paul.j3create