git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What type of error is it


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