mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
If an extension can't be loaded, print warning and skip it instead of
erroring out.
This commit is contained in:
parent
ff59f3c416
commit
b00e89faab
2 changed files with 9 additions and 3 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue