Message322229
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. |
|
Date |
User |
Action |
Args |
2018-07-23 16:16:37 | paul.j3 | set | recipients:
+ paul.j3, porton |
2018-07-23 16:16:37 | paul.j3 | set | messageid: <1532362597.92.0.56676864532.issue34191@psf.upfronthosting.co.za> |
2018-07-23 16:16:37 | paul.j3 | link | issue34191 messages |
2018-07-23 16:16:37 | paul.j3 | create | |
|