From aef82d3d1ed9456fe973b667441849e53e1b7ba1 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sat, 14 Apr 2012 20:44:23 -0400 Subject: [PATCH] IDLE was relying on implicit relative imports which have gone away in Python 3.3 thanks to importlib finishing the work in PEP 328 that accidently got carried forward. --- Lib/idlelib/EditorWindow.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 6a01db01253..de74e58c0fb 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -1,8 +1,9 @@ -import sys +import imp +import importlib import os import re import string -import imp +import sys from tkinter import * import tkinter.simpledialog as tkSimpleDialog import tkinter.messagebox as tkMessageBox @@ -1005,7 +1006,10 @@ class EditorWindow(object): def load_extension(self, name): try: - mod = __import__(name, globals(), locals(), []) + try: + mod = importlib.import_module('.' + name, package=__package__) + except ImportError: + mod = importlib.import_module(name) except ImportError: print("\nFailed to import extension: ", name) raise