Skip to content

Commit

Permalink
[TVMC] fail gracefully in case no subcommand is provided (apache#6625)
Browse files Browse the repository at this point in the history
  • Loading branch information
leandron authored and trevor-m committed Oct 19, 2020
1 parent eec1489 commit b4db42d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/tvm/driver/tvmc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ def _main(argv):
sys.stdout.write("%s\n" % version)
return 0

assert hasattr(args, "func"), "Error: missing 'func' attribute for subcommand {0}".format(argv)
if not hasattr(args, "func"):
# In case no valid subcommand is provided, show usage and exit
parser.print_help(sys.stderr)
return 1

try:
return args.func(args)
Expand Down

0 comments on commit b4db42d

Please sign in to comment.