What type of error is it

Cecil Westerhof Cecil at decebal.nl
Wed Jun 26 07:55:41 EDT 2019


I am writing a GUI program with tkinter. One function I have is:
def select_dir():
    try:
        directory = filedialog.askdirectory()
        if directory == '':
            messagebox.showinfo(info_str, canceled_report)
            return
        chdir(directory)
        filepathArr = sorted(glob(regex))
        if len(filepathArr) == 0:
            messagebox.showwarning(warning_str, nofiles_str)
            return
        generate_report(filepathArr)
    except:
       messagebox.showerror(error_str, error_select_str)
       raise

I use the raise to see what the exception was. That works, because
tkinter takes over again.
This works for me when I run it from the command-line, but it has to
become a stand-alone executable. Is there a way to find out what the
cause of the exception was, so I can put it in the error message?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof



More information about the Python-list mailing list