Nov-25-2022, 06:59 AM
I am using sftp.put() to upload files into SFTP server.But i am following error
In the sftpconnection.py i have the following code to upload the file to sftp server
any inputs ?
Error:No such file or directory
This is my present folder structure:1 2 3 4 5 6 7 8 |
- Django_Project - djangoapp - scripts - sftpconnection.py - Django_Project - xmloutput - output.xml |
1 2 3 4 5 6 7 |
def upload_to_sftp(request): cnOpts = pysftp.CnOpts() cnOpts.hostkeys = None sftp = pysftp.Connection(host = "10.23.43.56" , username = "xxxxx" , password = "xxxx" , port = 22 ,cnopts = cnOpts) sftp.put(localpath = '../../xmloutput/Output.xml' , remotepath = sftp.cwd( "/srv/sftp/inbox" )) sftp.close() |