I am trying to upload a CSV file to an SFTP server from my machine. I don't know why my code is not able to find the file. Need little help to identify the issue. Here's my code
import pysftp as sftp
def sftpExample():
try:
cnopts = sftp.CnOpts()
cnopts.hostkeys = None
s = sftp.Connection(host='abc.net', username='xyz', password='aaaaaaaaaaaa',cnopts=cnopts)
remotepath = 'http://sftp.abc.net/uploads/'
localpath = '/Users/ashish.verma/Desktop/Text.rtf'
s.put(localpath,remotepath)
s.close()
except Exception as e:
print(e)
sftpExample()
Connection to the SFTP server is successful, but I don't know why my code is not able to find the file on my local machine. Error message says:
No such file