ftplib possible bug? Please help.

Fredrik Lundh fredrik at pythonware.com
Mon Jun 18 15:26:50 EDT 2001


"Marshall" wrote:
> I am using Python 2.0 on NT 4.0
> When I ftp a file from one NT server to another, using ftplib, it
> changes the end of the line from CRLF to LF. It does this EVEN when
> the transfer is Binary.

> Is this a known problem?

you need to open the local file in binary mode too.  e.g:

        ftp.retrbinary("RETR " + file, open(file, "wb"))

or

        ftp.storbinary("STOR " + file, open(file, "rb"), 1024)

the "open" function is documented under "built-in functions" in
the library reference.

</F>

<!-- (the eff-bot guide to) the python standard library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->





More information about the Python-list mailing list