0

I'm trying to write on hosted file from python, so I chose to use ftplib module. So far i got this code

from ftplib import FTP
import io
ftp = FTP('ftp.myhostname.com')
ftp.login('myusername','mypass')
#ftp.retrlines('LIST')
bio = io.BytesIO(b'randomtext')
ftp.storbinary('STOR test.php', bio)
#ftp.retrbinary('RETR /test.php', "test", wb)
input()

but it overwrites the previous text.

Matteo
  • 19
  • 5
  • Does that imply that you want to append the new contents to an end of an existing file? See [Append data to file on FTP server in Python](https://stackoverflow.com/q/30103662/850848). – Martin Prikryl Jan 28 '21 at 12:02
  • @MartinPrikryl I got this error `ftplib.error_temp: 451 Append/Restart not permitted, try again` and I dont want to append text file, I want to append just text – Matteo Jan 28 '21 at 20:03
  • Then you server does not support appending. – Martin Prikryl Feb 01 '21 at 08:04

0 Answers0