[ python-Bugs-1032875 ] ftplib has incomplete transfer when sending files in Windows

SourceForge.net noreply at sourceforge.net
Thu Aug 3 22:21:50 CEST 2006


Bugs item #1032875, was opened at 2004-09-22 15:21
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1032875&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Works For Me
Priority: 5
Submitted By: Ed Sanville (infinity314)
Assigned to: Nobody/Anonymous (nobody)
Summary: ftplib has incomplete transfer when sending files in Windows

Initial Comment:
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.


----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2006-08-03 16:21

Message:
Logged In: YES 
user_id=11375

No further word on this bug, and it seems likely to have
been the 'rb' issue.  Closing this bug.


----------------------------------------------------------------------

Comment By: engelbert gruber (grubert)
Date: 2004-10-05 22:50

Message:
Logged In: YES 
user_id=147070

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

if this works please close the bug.

----------------------------------------------------------------------

Comment By: engelbert gruber (grubert)
Date: 2004-10-05 10:19

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1032875&group_id=5470


More information about the Python-bugs-list mailing list