生活随笔
收集整理的這篇文章主要介紹了
python ftp 上传文档出现 553 Could not create file
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
報(bào)錯(cuò)內(nèi)容:
*cmd* 'TYPE I'
*put* 'TYPE I\r\n'
*get* '200 Switching to Binary mode.\r\n'
*resp* '200 Switching to Binary mode.'
*cmd* 'PASV'
*put* 'PASV\r\n'
*get* '227 Entering Passive Mode (10,65,252,38,254,125).\r\n'
*resp* '227 Entering Passive Mode (10,65,252,38,254,125).'
*cmd* 'STOR DODWAL0103920180507010001.AVL'
*put* 'STOR DODWAL0103920180507010001.AVL\r\n'
*get* '553 Could not create file.\r\n'
*resp* '553 Could not create file.'
553 Could not create file.
錯(cuò)誤原因: 遠(yuǎn)程路徑?jīng)]有權(quán)限
ftp = ftpconnect("ip地址", "用戶名", "密碼",'遠(yuǎn)程路徑')
下面為借鑒代碼:源地址:https://blog.csdn.net/dingqingsong/article/details/44243651
??from?ftplib?import?FTP??????????def?ftpconnect():??????ftp_server?=?'10.***.***.**'????????username?=?'tom'????????password?=?'*******'????????timeout?=30??????port?=?21????????????ftp=FTP()????????ftp.set_debuglevel(2)?????????????ftp.connect(ftp_server,port,timeout)????????ftp.login(username,password)????????????????????return?ftp????????????def?downloadfile_from_FTP():??????ftp?=?ftpconnect()????????print?ftp.getwelcome()????????????????bufsize?=?1024????????????????????????remotepath?=?"\\Home\\product\\tom\\win7.iso"??????localpath?=?'D:\\tom\\win7.iso'??????????????fp?=?open(localpath,"wb")???????ftp.retrbinary('RETR?%s'?%?remotepath,fp.write,bufsize)?????????????ftp.set_debuglevel(0)?????????????fp.close()????????????????????????ftp.quit()??????????????????def?uploadfile_to_FTP():??????ftp?=?ftpconnect()????????print?ftp.getwelcome()???????????????bufsize?=?1024????????remotepath?=?"\\Home\\product\\tom\\win8.iso"????????localpath?=?'D:\\system\\win8.iso'??????????????fp?=?open(localpath,'rb')??????????????ftp.storbinary('STOR?'+?remotepath?,fp,bufsize)???????ftp.set_debuglevel(0)???????????????fp.close()??????????????????????????ftp.quit()????????????????????if?__name__?==?"__main__":????????????uploadfile_to_FTP() ?
總結(jié)
以上是生活随笔為你收集整理的python ftp 上传文档出现 553 Could not create file的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。