diff options
author | Kurt B. Kaiser <kbk@shore.net> | 2005-01-18 00:54:58 +0000 |
---|---|---|
committer | Kurt B. Kaiser <kbk@shore.net> | 2005-01-18 00:54:58 +0000 |
commit | b00e89faab0d69feb040118bbc5ea6149e91867f (patch) | |
tree | 1862b6043f8088edae46b210a8bb038ac6e0a0fe /Lib/idlelib/EditorWindow.py | |
parent | ff59f3c416a903179ea0b08db7575eddfde65ceb (diff) | |
download | cpython-git-b00e89faab0d69feb040118bbc5ea6149e91867f.tar.gz |
If an extension can't be loaded, print warning and skip it instead of
erroring out.
Diffstat (limited to 'Lib/idlelib/EditorWindow.py')
-rw-r--r-- | Lib/idlelib/EditorWindow.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 4015c9eea6..5e0a57158a 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -744,7 +744,11 @@ class EditorWindow(object): return idleConf.GetExtensions(editor_only=True) def load_extension(self, name): - mod = __import__(name, globals(), locals(), []) + try: + mod = __import__(name, globals(), locals(), []) + except ImportError: + print "\nFailed to import extension: ", name + return cls = getattr(mod, name) keydefs = idleConf.GetExtensionBindings(name) if hasattr(cls, "menudefs"): @@ -762,7 +766,6 @@ class EditorWindow(object): methodname = methodname + "_event" if hasattr(ins, methodname): self.text.bind(vevent, getattr(ins, methodname)) - return ins def apply_bindings(self, keydefs=None): if keydefs is None: |