I'm trying to upload file to SFTP server from my local directory. Here is my code
import paramiko
import pysftp
hostname = 'host'
username='user'
password='password'
port=port
source = 'c:/test.csv'
destination = '/home/local'
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname=hostname,port=port,username=username,password=password)
ftp_client=client.open_sftp()
ftp_client.put(source,destination)
ftp_client.close()
I'm getting an IOError
Using the .put() method, the remotepath should include the filename, see documentation at http://docs.paramiko.org/en/2.4/api/sftp.html#paramiko.sftp_client.SFTPClient.put
来源:https://stackoverflow.com/questions/50632535/upload-file-to-sftp-using-python
