Simple way to get a directory of a file and open it: from tkinter.filedialog import askopenfilename filename = askopenfilename()