在python上使用sftp时出现主机密钥错误

时间:2020-05-09 02:00:35

标签: python python-3.x sftp

嗨,我正在尝试获取要在python 3中使用sftp上传的文件,每次运行代码时,这就是我的代码

def placeFile():

    srv = pysftp.Connection(host=fpthost, username=ftpuser, password=ftppassword, log="ftplot.log")
    cnopts = pysftp.CnOpts()
    cnopts.hostkeys = None
    srv.put(filelocation + filetosend)  

    # Closes the connection
    srv.close()


print("Starting FTP upload")
print(filelocation + filetosend)
placeFile()
print("FTP upload complete")

get_hostkey中的文件“ D:\ PC Files \ Desktop \ code \ frazer \ ftp \ lib \ site-packages \ pysftp__init __。py”,第71行 引发SSHException(“找不到主机%s的主机密钥。”%host) paramiko.ssh_exception.SSHException:找不到主机ftp.adby.com.au的主机密钥。

请问我该如何解决

0 个答案:

没有答案
相关问题