I am trying to read the contents of text files on an FTP server, my code can make a connection and list all files present in the directory. However, it is failing here:
from io import BytesIO
import os
r = BytesIO()
ftp.retrbinary("RETR " + "textfile.txt", r)
print (r)
This prints:
<_io.BytesIO object at 0x03C2CCF0>
Firstly I'm not entirely sure what this means so If someone could shed some light on that I would be grateful.
Also when I try the following code to decode the returned value I get this error:
TypeError: '_io.BytesIO' object is not callable
Code looks like this:
r = BytesIO()
ftp.retrbinary("RETR " + "textfile.txt", r)
print (r.decode("utf-8"))