Author danonymous
Recipients amaury.forgeotdarc, aymanhs, danonymous, giampaolo.rodola, pitrou, rdevaughn, vstinner
Date 2010-08-24.14:29:32
SpamBayes Score 9.87543e-14
Marked as misclassified No
Message-id <>
There seems to be a lot of confusion on this thread.  So I'll add mine and hopefully clear things up a bit.    In short I think aymanhs has it right.

This is what I get when trying to send a simple text file on a Windows Xp PC using python 3.x
    ftp.storlines('STOR ' + localFile, fd)                  # Send the file by issuing the STOR command.
  File "C:\Python30\lib\", line 477, in storlines
    if buf[-1] in B_CRLF: buf = buf[:-1]
TypeError: Type str doesn't support the buffer API


getting up on my soap box....  :-)

FTP has two modes binary and ascii.  When doing binary you expect your data to be sent as is with NO changes.  When doing ascii, you expect to send a text file with your line endings to be adjusted if they are not the same on the two platforms involved in the FTP transfer (MAC, Linux, PC, etc.).  

So I do think it's an bug.  Every other FTP program I've used, and it's a long list, has two distinct modes ASCII and Binary.  When using ASCII, the line endings are translated.  I don't know enough to comment on whether the ascii code for every character is supposed to be 127 or less.  But I can tell you that I've never had another FTP program fail like Python 3 is failing for me trying to what seems like a simple transfer of a text file (expecting the line endings to be adjusted).  

I think the goal here should be (must be) to make it work like it is expected to work, based on the expectations of millions of people who have been using FTP programs which have come before python for several decades.  The other finer points are really not important.

stepping off the soap box.
Date User Action Args
2010-08-24 14:29:35danonymoussetrecipients: + danonymous, amaury.forgeotdarc, pitrou, vstinner, giampaolo.rodola, aymanhs, rdevaughn
2010-08-24 14:29:35danonymoussetmessageid: <>
2010-08-24 14:29:33danonymouslinkissue6822 messages
2010-08-24 14:29:32danonymouscreate