no such file or directory in SFTP - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: no such file or directory in SFTP (/thread-38792.html) |
no such file or directory in SFTP - saisankalpj - Nov-25-2022 I am using sftp.put() to upload files into SFTP server.But i am following error This is my present folder structure:- Django_Project -djangoapp -scripts -sftpconnection.py -Django_Project -xmloutput -output.xmlIn the sftpconnection.py i have the following code to upload the file to sftp server 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()any inputs ? RE: no such file or directory in SFTP - Larz60+ - Nov-25-2022 Please, always show entire unaltered error traceback as it contains valuable debugging information. RE: no such file or directory in SFTP - DeaD_EyE - Nov-25-2022 Relative paths do not work. localpath='../../xmloutput/Output.xml'This is also wrong: remotepath=sftp.cwd("/srv/sftp/inbox")This works because cwd returns None and the default argument for remotepath is a None .
|