我试图将我的文件从c:\ test复制到我的FTP文件夹;这是我的代码:
import ftplib
import socket
Name = socket.gethostname()
filename = Name +".csv"
ftp = ftplib.FTP('xxxxxxxxxxxxxxxxxx')
ftp.login('xxxxxx','xxxxxxxx')
ftp.cwd('test')
filematch = "C:\\test\\" + Name + ".csv"
filetocopy = open(filematch,'r')
ftp.storlines('STOR' +filename , filetocopy)
但我遇到了错误:
raise error_perm, resp
ftplib.error_perm: 500 ?
答案 0 :(得分:2)
解决:
import ftplib
import socket
Name = socket.gethostname()
filename = Name +".csv"
ftp = ftplib.FTP('xxxxxxxxxxxxxxxxxx')
ftp.login('xxxxxx','xxxxxxxx')
ftp.cwd('test')
filematch = "C:\\test\\" + Name + ".csv"
filetocopy = open(filematch,'r')
ftp.storlines('STOR ' + filename, filetocopy)