Message173685
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. |
|
Date |
User |
Action |
Args |
2012-10-24 14:12:14 | telmich | set | recipients:
+ telmich, bethard, r.david.murray |
2012-10-24 14:12:14 | telmich | set | messageid: <1351087934.17.0.937545947078.issue16308@psf.upfronthosting.co.za> |
2012-10-24 14:12:14 | telmich | link | issue16308 messages |
2012-10-24 14:12:14 | telmich | create | |
|