Remove more usage of APIs deprecated by PEP 451.

This commit is contained in:
Eric Snow 2014-01-06 20:42:59 -07:00
parent 3a62d14b24
commit 02b9f9d6bb
3 changed files with 16 additions and 14 deletions

View file

@ -659,20 +659,20 @@ class EditorWindow(object):
return
# XXX Ought to insert current file's directory in front of path
try:
loader = importlib.find_loader(name)
spec = importlib.find_spec(name)
except (ValueError, ImportError) as msg:
tkMessageBox.showerror("Import error", str(msg), parent=self.text)
return
if loader is None:
if spec is None:
tkMessageBox.showerror("Import error", "module not found",
parent=self.text)
return
if not isinstance(loader, importlib.abc.SourceLoader):
if not isinstance(spec.loader, importlib.abc.SourceLoader):
tkMessageBox.showerror("Import error", "not a source-based module",
parent=self.text)
return
try:
file_path = loader.get_filename(name)
file_path = spec.loader.get_filename(name)
except AttributeError:
tkMessageBox.showerror("Import error",
"loader does not support get_filename",