telmich added the comment: I've copy & pasted the example from the documentation and added the following lines to it (attached full file)
args = parser.parse_args('') args.func(args) Following the style / way show in the documentation, I'd expect this block to work (3.2.2 behaviour). I do however understand from a logical point that this does not work: * no subparsers are required * no argument is required => args.func is never setup One could check for this situation using getattr: try: a = getattr(args, "func") except AttributeError: parser['main'].print_help() sys.exit(0) Though this look quite manual compared to the usual way of using argparse. ---------- Added file: http://bugs.python.org/file27695/subparse2.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16308> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com