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")
. The ftp://
is only mandatory for a URI but the ftplib library expect the hostname of your FTP server.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.