d nazario <[email protected]> added the comment:
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\ftplib.py", 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.
----------
nosy: +danonymous
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue6822>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com