I created a .exe file from my .py project. And when I try to save and output the .csv file on the desktop I get 'error 13 permission denied', because I have no admin privileges. Instead, I need to save a file to C:/Users/Public to make it work. So, how do I make a pop-up window with this message using Tkinter, every time when I get 'error 13'? The error is shown in cmd only.
## Write output to csv file
def save_file():
path_to_output_file = fd.asksaveasfilename()
if not path_to_output_file:
return
file_count = 1
for rows in range(len(df)):
if rows % 500 == 0:
df[rows:rows+500].to_csv(path_to_output_file + str(file_count) + '.csv', index=False, header=True, quoting=csv.QUOTE_NONNUMERIC)
file_count += 1
If you've already got the error message, you can use tkinter.messagebox.showinfo
function to create a pop-up window and show the error message.
You can find the docs here:
https://docs.python.org/3/library/tkinter.messagebox.html