使用python的ftplib模块传输文件时,服务器返回551错误代码。但是可以通过手动输入linux命令成功传输。
在Linux服务器上运行python2.7代码。
def upload(self, file_local_path, file_remote):
bufsize = 1024
fp = open(file_local_path, 'rb')
self.ftp.storbinary('STOR ' + file_remote, fp, bufsize)
return
2019-04-18 15:01:02,215 - upload/upload.py[line:57] - ERROR: Traceback (most recent call last):
File "upload/upload.py", line 50, in performing_tasks
ftp.upload(os.path.join(get_config.bill_file_out_path, file), get_config.ftp_upload_remote + file)
File "/data/bboss/bossscript/upload/ftp_file.py", line 51, in upload
self.ftp.storbinary('STOR /imcoming/SIM_CDR/SIM_20190418.1352',fp,bufsize)
File "/data/python27/lib/python2.7/ftplib.py", line 478, in storbinary
return self.voidresp()
File "/data/python27/lib/python2.7/ftplib.py", line 229, in voidresp
resp = self.getresp()
File "/data/python27/lib/python2.7/ftplib.py", line 224, in getresp
raise error_perm, resp
error_perm: 551 /imcoming/SIM_CDR/SIM_20190418.1352: Error on output file.