diff --git a/saharaclient/openstack/common/importutils.py b/saharaclient/openstack/common/importutils.py index a0e66776..fcb8f04b 100644 --- a/saharaclient/openstack/common/importutils.py +++ b/saharaclient/openstack/common/importutils.py @@ -24,10 +24,10 @@ import traceback def import_class(import_str): """Returns a class from a string including module and class.""" mod_str, _sep, class_str = import_str.rpartition('.') + __import__(mod_str) try: - __import__(mod_str) return getattr(sys.modules[mod_str], class_str) - except (ValueError, AttributeError): + except AttributeError: raise ImportError('Class %s cannot be found (%s)' % (class_str, traceback.format_exception(*sys.exc_info())))