]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
If an extension can't be loaded, print warning and skip it instead of
authorKurt B. Kaiser <kbk@shore.net>
Mon, 17 Jan 2005 20:34:49 +0000 (20:34 +0000)
committerKurt B. Kaiser <kbk@shore.net>
Mon, 17 Jan 2005 20:34:49 +0000 (20:34 +0000)
erroring out.

Lib/idlelib/EditorWindow.py
Lib/idlelib/NEWS.txt

index b1f19fced5706b75f888b099f2eea98cc2dea634..2d340914e6c89b01f5421402535bc159fa1851ab 100644 (file)
@@ -770,7 +770,11 @@ class EditorWindow:
         return idleConf.GetExtensions()
 
     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 None
         cls = getattr(mod, name)
         ins = cls(self)
         self.extensions[name] = ins
index 9cbfa8e69398cafddf196c418b6594bab3b33e4e..0ffb65606d52bb33a51b1563e55235325fff65b8 100644 (file)
@@ -3,6 +3,9 @@ What's New in IDLE 1.0.4?
 
 *Release date: XX-Jan-2005*
 
+- If an extension can't be loaded, print warning and skip it instead of
+  erroring out.
+
 - Improve error handling when .idlerc can't be created.  This is a partial
   backport of configHandler.py, Revision 1.36,  11Jan05.