From c806e1e10a9a19402d6446607a9bb4c154376015 Mon Sep 17 00:00:00 2001 From: Chester Chen <512707+chesterxgchen@users.noreply.github.com> Date: Thu, 11 Jan 2024 19:55:47 -0800 Subject: [PATCH] handle none value for the subcommand parser (#2276) --- nvflare/cli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nvflare/cli.py b/nvflare/cli.py index 4319ed9608..316973f8ba 100644 --- a/nvflare/cli.py +++ b/nvflare/cli.py @@ -143,7 +143,8 @@ def parse_args(prog_name: str): if argv: msg = f"{prog_name} {cmd}: unrecognized arguments: {' '.join(argv)}\n" print(f"\nerror: {msg}") - sub_cmd_parser.print_help() + if sub_cmd_parser: + sub_cmd_parser.print_help() _parser.exit(2, "\n") return _parser, _parser.parse_args(), sub_cmd_parsers