I am first sorry to say that I do not have access to gitHub
or sourceForge.net
, so I can't retrieve solution like this: possible answer
I have half a giga (510199112 bytes
) to download by ftp but there is a time-out error:
ftplib.error_temp: 450 Socket write to client timed-out.
I would like to manage my time out butdo not know how to proceed in my current code:
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()