diff options
author | Lars Wirzenius <liw@liw.fi> | 2019-03-23 13:45:36 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2019-03-23 13:45:36 +0200 |
commit | e74ec68e3e14873dd348c55e5a318e185cbf72a1 (patch) | |
tree | c2f1acef49bfdf830bdb731a533089256c55ed40 | |
parent | 61f1fc798cd3447d1b926d33e7da450eb6273766 (diff) | |
download | effitool-e74ec68e3e14873dd348c55e5a318e185cbf72a1.tar.gz |
Change: add --debug option to show Python traceback on error
-rwxr-xr-x | effitool | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -23,6 +23,7 @@ import http import json import os import sys +import traceback import urllib.request @@ -448,6 +449,7 @@ def process_args(config): factory = p.add_subparsers() p.add_argument('-a', '--api') + p.add_argument('--debug', action='store_true') for name, func, args in subcommands: pp = factory.add_parser(name) @@ -460,6 +462,8 @@ def process_args(config): try: func(args) except Exception as e: + if args['debug']: + sys.stderr.write('{}\n'.format(traceback.format_exc())) sys.exit(str(e)) |