[issue6822] Error calling .storlines from ftplib

STINNER Victor report at bugs.python.org
Fri Aug 27 20:28:25 CEST 2010


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

pitrou> The FTP class is not supposed to guess in which charset 
pitrou> your data should be encoded.
pitrou> (the "encoding" argument on the FTP class is meant 
pitrou> for protocol commands (such as file names), not for file
pitrou> contents)

I agree, my patch is completly wrong :-) You should open your file in binary mode, not in text (unicode) mode. The issue is more a documentation bug, than a bug in ftplib behaviour.

Here is a new patch: very short patch on the doc (just add "binary" to "open binary file object *file*").

----------
components: +Documentation
Added file: http://bugs.python.org/file18663/ftplib_doc.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6822>
_______________________________________


More information about the Python-bugs-list mailing list