我很抱歉地说我无法访问gitHub
或sourceForge.net
,因此我无法检索此类解决方案:possible answer
我有半个千兆(510199112 bytes
)可以通过ftp下载,但是有一个超时错误:
ftplib.error_temp: 450 Socket write to client timed-out.
我想管理我的时间,但不知道如何继续我目前的代码:
ftp_host = 'someFTP'
login_user = 'johnDoe'
pwd = 'secret'
print "connection to ftp %s with user %s" %(ftp_host,login_user)
ftp = ftplib.FTP(ftp_host)
ftp.set_debuglevel(1)
ftp.login(login_user,pwd)
filename = 'bigFile.txt'
destination = open('C:/mydestination')
try:
print "retrieving file %s to %s" % (filename, destination)
ftp.retrbinary('RETR %s' % filename, destination.write)
except Exception as e:
destination.close()
print "closing connection"
ftp.quit()
raise
print "closing connection"
ftp.quit()
destination.close()