From 9075cc4671e8e045c960e01e4b1e018a93ea2ec2 Mon Sep 17 00:00:00 2001 From: "Kurt B. Kaiser" Date: Mon, 17 Jan 2005 20:34:49 +0000 Subject: [PATCH] If an extension can't be loaded, print warning and skip it instead of erroring out. --- Lib/idlelib/EditorWindow.py | 6 +++++- Lib/idlelib/NEWS.txt | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index b1f19fced570..2d340914e6c8 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -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 diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 9cbfa8e69398..0ffb65606d52 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -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. -- 2.47.3