# 需要导入模块: import importlib [as 别名]
# 或者: from importlib import abc [as 别名]
def open_module(self, event=None):
# XXX Shouldn't this be in IOBinding?
try:
name = self.text.get("sel.first", "sel.last")
except TclError:
name = ""
else:
name = name.strip()
name = tkSimpleDialog.askstring("Module",
"Enter the name of a Python modulen"
"to search on sys.path and open:",
parent=self.text, initialvalue=name)
if name:
name = name.strip()
if not name:
return
# XXX Ought to insert current file's directory in front of path
try:
spec = importlib.util.find_spec(name)
except (ValueError, ImportError) as msg:
tkMessageBox.showerror("Import error", str(msg), parent=self.t
最后
以上就是大意麦片最近收集整理的关于python importlib详解,Python importlib.abc方法代码示例的全部内容,更多相关python内容请搜索靠谱客的其他文章。
发表评论 取消回复