Python:提出error_perm,resp ftplib.error_perm:500?

时间:2015-08-27 23:55:44

标签: python ftplib

我试图将我的文件从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 ?

1 个答案:

答案 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)