📜  如何在 python 代码示例中接受 invalidfileexception

📅  最后修改于: 2022-03-11 14:45:31.631000             🧑  作者: Mango

代码示例1
from tkinter import messagebox
from tkinter import filedialog

from openpyxl.utils.exceptions import InvalidFileException
...

    def browseXLL(self,event):
        try:
            file = filedialog.askopenfilename()
        except InvalidFileException:

            self.window.destroy()
            self.__init__()