From 5bf2cf7f8d268c62ac658a1d92b316a472b4c545 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Wed, 29 Oct 2008 20:30:40 +0600 Subject: [PATCH] with_eventlet.py: check that reactor is provided as a param to --hub (a common mistake) --- greentest/with_eventlet.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/greentest/with_eventlet.py b/greentest/with_eventlet.py index 7f24d24..7f73f8b 100755 --- a/greentest/with_eventlet.py +++ b/greentest/with_eventlet.py @@ -20,7 +20,17 @@ def setup_hub(hub, reactor): import_reactor(reactor).install() if hub is not None: from eventlet.api import use_hub - use_hub(hub) + try: + use_hub(hub) + except ImportError: + # as a shortcut, try to import the reactor with such name + try: + r = import_reactor(hub) + except ImportError: + sys.exit('Nu such hub: %s' % hub) + else: + r.install() + use_hub('twistedr') def parse_args(): hub = None