Skip to content
Advertisement

Upload file via SFTP with Python

I wrote a simple code to upload a file to a SFTP server in Python. I am using Python 2.7.

JavaScript

The file did not appear on the server. However, no error message appeared. What is wrong with the code?

I have enabled logging. I discovered that the file is uploaded to the root folder and not under public folder. Seems like srv.cd('public') did not work.

Advertisement

Answer

I found the answer to my own question.

JavaScript

Put the srv.put inside with srv.cd

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement