New submission from Matthew H. McKenzie <[email protected]>:
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
----------
components: Library (Lib)
files: crap2.txt
messages: 405921
nosy: mckenzm
priority: normal
severity: normal
status: open
title: ftplib please revisit retrlines('RETR as it produces files without
newlines
versions: Python 3.11
Added file: https://bugs.python.org/file50429/crap2.txt
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45746>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com