Issue 1032875: ftplib has incomplete transfer when sending files in Windows (original) (raw)

I wrote the following short script:

from ftplib import FTP

ftp=FTP('ftp.edsanville.us', username, password) print ftp.getwelcome() print ftp.storbinary('stor test.xls', file('test.xls', 'r'))

ftp.quit()

It transfers the entire file under Red Hat Linux 9, but under Windows XP, it only transfers a couple kilobytes at most. Using a hex editor, I found that the first 5 or 6 bytes of the file are OK on the remote side after transfer, but the rest of the file is totally wrong. I'm at a loss, it doesn't make any sense. Please, somebody tell me I'm not insane.

Logged In: YES user_id=147070

looks like a file problem: f=open('test.xls');d=f.read() reads all the file. on winxp/py234 not

making a binary file: for i in range(0,50):for d in range(0,255): f.write(d)

reading it: d=f.read() 1.round len(d) = 26, f.tell() 12288 2.round len(d) = 26, f.tell() 12800

chr(26) is the end of a dos textfile.