Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Throw ImportError on import_string failure #969

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion raven/utils/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ def import_string(key):

module_name, class_name = key.rsplit('.', 1)
module = __import__(module_name, {}, {}, [class_name], 0)
return getattr(module, class_name)
try:
return getattr(module, class_name)
except AttributeError as ex:
raise ImportError(unicode(ex))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will NameError on python 3.