"No such file" error when using paramiko's sftp

linux, paramiko, python, python-2.7, ssh

Solution

The problem is most likely that the remote directory does not exist (`/home/developers/screenshots`). Create the directory and try again.

Problem

I want to file transfer local to server using python ``` #!/usr/bin/env python import os import paramiko ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(hostname, username="username", password="password") ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command('ls /tmp') print "output", ssh_stdout.read() #Reading output of the executed command error = ssh_stderr.read() #Reading the error stream of the executed command print "err", error, len(error) #Transfering files to and from the remote machine sftp = ssh.open_sftp() #sftp.get("/home/developers/screenshots/ss.txt", "/home/e100075/python/ss.txt") sftp.put('/home/e100075/python/ss.txt', '/home/developers/screenshots/ss.txt') sftp.close() ssh.close() ``` After running i got the errors below ``` File "file_copy.py", line 21, in <module> sftp.put('/home/e100075/python/ss.txt', '/home/developers/screenshots/ss.txt') File "/usr/lib/python2.7/dist-packages/paramiko/sftp_client.py", line 565, in put fr = self.file(remotepath, 'wb') File "/usr/lib/python2.7/dist-packages/paramiko/sftp_client.py", line 245, in open t, msg = self._request(CMD_OPEN, filename, imode, attrblock) File "/usr/lib/python2.7/dist-packages/paramiko/sftp_client.py", line 635, in _request return self._read_response(num) File "/usr/lib/python2.7/dist-packages/paramiko/sftp_client.py", line 682, in _read_response self._convert_status(msg) File "/usr/lib/python2.7/dist-packages/paramiko/sftp_client.py", line 708, in _convert_status raise IOError(errno.ENOENT, text) IOError: [Errno 2] No such file ``` If you know the answer. please let me know thanks for reading..

Original source