0

I want a user to be able to choose where to save a file through one of these windows, but I don't know how.

So far all I have for downloading is

dst_folder = input("Enter in the folder you want to download this file to: ")
stream.download(dst_folder)

This works, but you can type in literally anything for the input.

  • 1
    What window/GUI framework are you using? – John Gordon Feb 16 '23 at 23:47
  • "This works, but you can type in literally anything for the input." You realistically will still have to validate the name that you get back. Or more realistically, live with the fact that saving a file can fail for other reasons besides an "invalid" name/path. – Karl Knechtel Feb 17 '23 at 01:10

1 Answers1

0

Please try this method

from tkinter import filedialog
from tkinter import *

root = Tk()
root.withdraw()

# Ask the user to select a folder
folder_selected = filedialog.askdirectory()

# Use the selected folder to download the file
stream.download(folder_selected)