I upload a file via SFTP using Paramiko with sftp.put(localFile, remoteFile) . First I create the necessary directory, if necessary, using
makeCommand = 'mkdir -p "' + remotePath + '"' ssh.exec_command(makeCommand)
this worked sometimes, but sometimes I get the following error:
sftp.put(localFile, remoteFile) File "build/bdist.macosx-10.8-intel/egg/paramiko/sftp_client.py", line 565, in put File "build/bdist.macosx-10.8-intel/egg/paramiko/sftp_client.py", line 245, in open File "build/bdist.macosx-10.8-intel/egg/paramiko/sftp_client.py", line 635, in _request File "build/bdist.macosx-10.8-intel/egg/paramiko/sftp_client.py", line 682, in _read_response File "build/bdist.macosx-10.8-intel/egg/paramiko/sftp_client.py", line 708, in _convert_status IOError: [Errno 2] No such file
even though the local file definitely exists (and localFile is the correct path to it) and the remote path. There is a discussion here and here on a similar issue, but none of the issues raised there have helped. My server supports the df -hi . Anyone have any advice on this or a possible solution?
EDIT
After the suggestions below, I tried changing the working directory to sftp.chdir(remoteDirectory) , but this call caused the same error as above. This doesn't seem to be just a download problem. Any ideas?
source share