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.
This commit is contained in:
Brett Cannon 2012-04-14 20:44:23 -04:00
parent 44590e4786
commit aef82d3d1e

View file

@ -1,8 +1,9 @@
import sys import imp
import importlib
import os import os
import re import re
import string import string
import imp import sys
from tkinter import * from tkinter import *
import tkinter.simpledialog as tkSimpleDialog import tkinter.simpledialog as tkSimpleDialog
import tkinter.messagebox as tkMessageBox import tkinter.messagebox as tkMessageBox
@ -1005,7 +1006,10 @@ class EditorWindow(object):
def load_extension(self, name): def load_extension(self, name):
try: try:
mod = __import__(name, globals(), locals(), []) try:
mod = importlib.import_module('.' + name, package=__package__)
except ImportError:
mod = importlib.import_module(name)
except ImportError: except ImportError:
print("\nFailed to import extension: ", name) print("\nFailed to import extension: ", name)
raise raise