I am trying to have this code do the following
- Ask the user which folder they want to download too.
- Down load the file from the FTP server to the selected file
but when ever I run the following code it just downloads/ writes the file to the local directory
how can I have the code write to the selected folder and not the local directory.
here is the code I am working with
root = tk.Tk()
root.withdraw()
FTP_HOST = HOST
FTP_USER = USER
FTP_PASS = PASS
down_load_path=fd.askdirectory()
ftp = ftplib.FTP(FTP_HOST, FTP_USER, FTP_PASS)
file_downloaded=ftp.retrbinary("RETR " + 'work out app outline1.txt', open('work out app outline1.txt', 'wb').write)
file_downloaded.write(down_load_path)
ftp.quit()
root.mainloop()
I keep getting error AttributeError: 'str' object has no attribute 'write'