I’m trying to upload a text file to an FTP server, but I am getting this error:
gaierror: [Errno 11004] getaddrinfo failed
Here is my code.
s = ftplib.FTP("ftp://xbrera.co.cc", "myuser", "mypass")
f = open(path + "LD.txt", "r")
s.storbinary("STOR " + path + "LD.txt")
f.close()
s.quit()
What am I doing wrong, and why am I getting this error? Thanks!
Change your code to
s = ftplib.FTP("xbrera.co.cc", "myuser", "mypass"). Theftp://is only mandatory for a URI but the ftplib library expect the hostname of your FTP server.