From: Kurt B. Kaiser Date: Mon, 17 Jan 2005 20:34:49 +0000 (+0000) Subject: If an extension can't be loaded, print warning and skip it instead of X-Git-Tag: v2.3.5c1~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9075cc4671e8e045c960e01e4b1e018a93ea2ec2;p=thirdparty%2FPython%2Fcpython.git If an extension can't be loaded, print warning and skip it instead of erroring out. --- 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.