This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mckenzm
Recipients mckenzm
Date 2021-11-08.01:49:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1636336170.65.0.433543407195.issue45746@roundup.psfhosted.org>
In-reply-to
Content
Lib/ftplib.py  function retrlines

Inspired by documentation the following writes a file without line-endings:
 
from ftplib import FTP
ftp=FTP()
ftp.connect('hostname')
ftp.login('user','xxxxxxxx')
ftp.sendcmd('pasv')

with open('crap2.txt', 'w') as fp:
    ftp.retrlines('RETR crap.txt', fp.write)

Code goes to pains to slice off the line endings, and then print_line does not add them back? Apologies if this has been covered before, or I am not following the documentation correctly. Not going to suggest a fix as there may be a reason it is like this.

For RETR.
For ascii
History
Date User Action Args
2021-11-08 01:49:30mckenzmsetrecipients: + mckenzm
2021-11-08 01:49:30mckenzmsetmessageid: <1636336170.65.0.433543407195.issue45746@roundup.psfhosted.org>
2021-11-08 01:49:30mckenzmlinkissue45746 messages
2021-11-08 01:49:30mckenzmcreate