[Tutor] file transfered through ftplib not the right size
Michel Bélanger
michel.belanger at seidel.ca
Wed Feb 4 20:05:32 EST 2004
Hi all,
I open an ftp channel with my web site from the following commands:
ftp = ftplib.FTP("Host.com")
ftp.login("User","Password")
then the transfer call for a download is as follow:
getbinary(ftp, row[0], row[0])
but the file received is not the right size (larger), i.e. 5150 kb
received vs 5136 kb
Any idea why?
def getbinary(ftp, filename, outfile=None):
# fetch a binary file
if outfile is None:
outfile = sys.stdout
f = open(outfile, "w")
ftp.retrbinary("RETR " + filename, f.write)
f.flush()
f.close()
Many thanks
Michel Belanger
More information about the Tutor
mailing list