]> 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>
Wed, 19 Jan 2005 17:25:05 +0000 (17:25 +0000)
committerKurt B. Kaiser <kbk@shore.net>
Wed, 19 Jan 2005 17:25:05 +0000 (17:25 +0000)
erroring out.

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

index 5d639913aa272a887aa1b0391c0b0520f9a86b89..c0b66a3aa06a1a233b3820273ec3339c899cef8b 100644 (file)
@@ -744,7 +744,11 @@ class EditorWindow:
         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 None
         cls = getattr(mod, name)
         keydefs = idleConf.GetExtensionBindings(name)
         if hasattr(cls, "menudefs"):
index 248d3e8ef7b2c8cb5fc708eaca5cfafff56ed13a..7d188f2fe38fa2ae28e3f9be959d55538077fc03 100644 (file)
@@ -3,6 +3,9 @@ What's New in IDLE 1.1.1?
 
 *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 (warn and exit)
 
 - The GUI was hanging if the shell window was closed while a raw_input()