I am trying to upload a CSV file of 2mb on my FTP server. The internet is slow, so the program takes 20 seconds to write the complete file.
But the code is writing file line by line, I think. Every 1 second, the CSV file increases till it is fully uploaded.
I want the code to write the file only when it's 100% uploaded. How can I do that?
import pysftp
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
s=pysftp.Connection(host="xx.xx.xx.xx", username="root", password='abcpassword',cnopts=cnopts)
s.put(local_path, remote_path)
How to change s.put()
function, so it writes full only after it's 100% uploaded. Till that time, keep the file in memory/buffer something