From cd1424a5543ce01b3bd13887f2d1e818b8c296d3 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 17 Aug 2012 09:48:37 -0400 Subject: Don't trap then re-raise ImportError. When we catch ImportError, print a message, and then raise a new ImportError, we lose sane ability to read the traceback, and we gain nothing. Raising a new ImportError on Attribute or Value error is helpful, given the context in which we are working. Change-Id: I52f61405e63535bcc745c9d350aa0dfbae36a8ac --- openstack/common/importutils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openstack/common') diff --git a/openstack/common/importutils.py b/openstack/common/importutils.py index 2fbb029..f45372b 100644 --- a/openstack/common/importutils.py +++ b/openstack/common/importutils.py @@ -29,7 +29,7 @@ def import_class(import_str): try: __import__(mod_str) return getattr(sys.modules[mod_str], class_str) - except (ImportError, ValueError, AttributeError), exc: + except (ValueError, AttributeError), exc: raise ImportError('Class %s cannot be found (%s)' % (class_str, traceback.format_exception(*sys.exc_info()))) -- cgit