From dcde8102a21b041fc4304de30880ee2b37fe9c6b Mon Sep 17 00:00:00 2001 From: JamesRamm Date: Fri, 29 Sep 2017 18:48:52 +0200 Subject: [PATCH] Fixes #90 --- longclaw/bin/longclaw.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/longclaw/bin/longclaw.py b/longclaw/bin/longclaw.py index be44eab..354f636 100644 --- a/longclaw/bin/longclaw.py +++ b/longclaw/bin/longclaw.py @@ -68,7 +68,17 @@ def main(): build.set_defaults(func=build_assets) args = parser.parse_args() - args.func(args) + + # Python 3 lost the default behaviour to fall back to printing + # help if a subparser is not selected. + # See: https://bugs.python.org/issue16308 + # So we must explicitly catch the error thrown on py3 if + # no commands given to longclaw + try: + args.func(args) + except AttributeError: + parser.print_help() + sys.exit(0) if __name__ == "__main__": main()