From: Kurt B. Kaiser Date: Wed, 19 Jan 2005 17:25:05 +0000 (+0000) Subject: If an extension can't be loaded, print warning and skip it instead of X-Git-Tag: v2.4.1c1~72 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cdf41ba9efafafca3f75eea640a211c24969f90b;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 5d639913aa27..c0b66a3aa06a 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -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"): diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 248d3e8ef7b2..7d188f2fe38f 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -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()