How do you FTP ASCII if ftplib strips CR?

al at servana.com al at servana.com
Tue Jun 13 11:21:17 EDT 2000


If you look at the FTPLIB docs, it states that RETRLINES will strip 
CR when passing the text to the RETRLINES callback.

So, how do you put the CR back in if you want them?

When you FTP ascii from a non-similar platform, the loss of the CR 
causes the text to FTP as 'one line'. (like UNIX-to-UNIX and NT-to-NT 
work, UNIX-to-NT does not)

Yet ALL FTP tools do not do this, so only the Python scripts tend to 
munge ASCII files.

I was using the following notation, but cannot come up with another 
where I can control the append of a CR:

ourFTP.retrlines('RETR ' + filename, open(os.path.join(localdir, 
filename), 'w').write)

Any help would be appreciated.
We have two people on this for days and cannot come to a resolution 
to this apparently simple problem.

Thanks.





More information about the Python-list mailing list