I want to download an ASCII file. This was used to work in Python 2:
ftp = ftplib.FTP('ftp.domain.com') ftp.login('domain.com',password) ftp.cwd('subdirectory') ftp.storlines('STOR ' + 'file.htm', open('file.htm','r')) ftp.close()
However, in Python 3, it returns this error:
File "/usr/local/lib/python3.3/ftplib.py", line 497, in storlines if buf[-1] in B_CRLF: buf = buf[:-1] TypeError: Type str doesn't support the buffer API
What am I doing wrong?
source share