I have a program that creates a file and writes files to it. But it always displays this:
error: PermissionError: [Errno 13] Permission denied: 'C:/Users/Theo/Documents/testfolder'
How can I make it that it asks the user if they want to give this program Admin privileges and continues as normal?
Here is my code:
from tkinter import *
from tkinter import filedialog
import os
import subprocess
def getFile():
save_path = filedialog.askdirectory(title="Where to create ISO file?")
final_name = name.get()+".iso"
completeName = os.path.join(save_path, final_name)
open(str(completeName), 'x')
src_path = filedialog.askdirectory(title="Choose your directrory")
final_src = os.listdir(src_path)
with open(save_path, 'w') as f:
f.write(final_src)
root = Tk()
name = Entry(root)
name.pack()
button = Button(root,text="Start",command=getFile)
button.pack()
root.mainloop()