From 678935bd0e8b45c528c80a97ddb8551ec3428187 Mon Sep 17 00:00:00 2001 From: Tiara Rodney Date: Sat, 2 Apr 2022 19:51:05 +0200 Subject: [PATCH 1/2] fix: catch standalone command exception gevent will not be installed by default, therefore print a message explaining required steps --- src/httpaste/__main__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/httpaste/__main__.py b/src/httpaste/__main__.py index 399417f..24763f9 100644 --- a/src/httpaste/__main__.py +++ b/src/httpaste/__main__.py @@ -30,7 +30,14 @@ def command_standalone(**kwargs): """ from httpaste import load_config, get_flask_app - from gevent.pywsgi import WSGIServer + + try: + from gevent.pywsgi import WSGIServer + except ImportError as e: + raise ImportError(' '.join(( + 'gevent is currently not installed.', + 'Please install it by running \'python3 -m pip install gevent\'.' + ))) from e config, server_config = load_config(kwargs.get('config_path')) From 50af1a4587d1a6f965e1fbdb60601755857cfebb Mon Sep 17 00:00:00 2001 From: Tiara Rodney Date: Sat, 2 Apr 2022 19:51:52 +0200 Subject: [PATCH 2/2] fix(__main__): require command argument --- src/httpaste/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/httpaste/__main__.py b/src/httpaste/__main__.py index 24763f9..7b6de2f 100644 --- a/src/httpaste/__main__.py +++ b/src/httpaste/__main__.py @@ -103,7 +103,7 @@ def parser(): p = argparse.ArgumentParser(description='Process some integers.') - sp = p.add_subparsers(dest='command') + sp = p.add_subparsers(dest='command', required=True) p_standalone = sp.add_parser('standalone', help=command_standalone.__doc__) p_standalone.add_argument('--config-path', '-c', required=True)