This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: ftplib has incomplete transfer when sending files in Windows
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: akuchling, grubert, infinity314
Priority: normal Keywords:

Created on 2004-09-22 19:21 by infinity314, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
test.xls infinity314, 2004-09-22 19:21 the file I tried to upload using ftplib
Messages (4)
msg22518 - (view) Author: Ed Sanville (infinity314) Date: 2004-09-22 19:21
I wrote the following short script:

from ftplib import FTP

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


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.
msg22519 - (view) Author: engelbert gruber (grubert) * Date: 2004-10-05 14:19
Logged In: YES 

looks like a file problem: f=open('test.xls'); 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: 
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.
msg22520 - (view) Author: engelbert gruber (grubert) * Date: 2004-10-06 02:50
Logged In: YES 

For binary files on windows one has to use file('test.xls','rb').

if this works please close the bug.
msg22521 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2006-08-03 20:21
Logged In: YES 

No further word on this bug, and it seems likely to have
been the 'rb' issue.  Closing this bug.
Date User Action Args
2022-04-11 14:56:07adminsetgithub: 40943
2004-09-22 19:21:03infinity314create