ftplib上传下载卡住
ftplib upload and download get stuck
我正在尝试通过 Python 的 ftplib
库将文件上传到我的 VPS(由 GoDaddy 托管):
from ftplib import FTP
session = FTP('ftp.wangsibo.xyz','wsb','Wsb.139764')
file = open('source10.png','rb')
session.storbinary('store_source10.png', file)
file.close()
session.quit()
但是它卡在了第 4 行(文件只有几 k,而且需要几分钟)。当我尝试使用 retrbinary
.
阅读时,也会发生同样的事情
我试过使用 FileZilla,效果很好。有什么建议吗?
FTP.storbinary(command, fp[, blocksize, callback, rest])
Store a file in binary transfer mode. command should be an appropriate
STOR command: "STOR filename". fp is an open file object which is read
until EOF using its read() method in blocks of size blocksize to
provide the data to be stored.
store_source10.png
不是命令,你可以尝试使用STOR source10.png
.
例如
from ftplib import FTP
session = FTP('ftp.wangsibo.xyz','wsb','Wsb.139764')
file=open('source10.png','rb')
session.storbinary('STOR source10.png',file)
file.close()
session.quit()
我正在尝试通过 Python 的 ftplib
库将文件上传到我的 VPS(由 GoDaddy 托管):
from ftplib import FTP
session = FTP('ftp.wangsibo.xyz','wsb','Wsb.139764')
file = open('source10.png','rb')
session.storbinary('store_source10.png', file)
file.close()
session.quit()
但是它卡在了第 4 行(文件只有几 k,而且需要几分钟)。当我尝试使用 retrbinary
.
我试过使用 FileZilla,效果很好。有什么建议吗?
FTP.storbinary(command, fp[, blocksize, callback, rest])
Store a file in binary transfer mode. command should be an appropriate STOR command: "STOR filename". fp is an open file object which is read until EOF using its read() method in blocks of size blocksize to provide the data to be stored.
store_source10.png
不是命令,你可以尝试使用STOR source10.png
.
例如
from ftplib import FTP
session = FTP('ftp.wangsibo.xyz','wsb','Wsb.139764')
file=open('source10.png','rb')
session.storbinary('STOR source10.png',file)
file.close()
session.quit()