I am trying to use pysftp and gets the same error as many others. That there is no hostkey for host. I have tried many fixes, but none of them seem to work.
When I try to set hostname I get these errors:
cnopts = pysftp.CnOpts()
cnopts.hostkeys.load('known_hosts')
with pysftp.Connection(host, username, password, cnopts=cnopts) as sftp:
/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/pysftp/__init__.py:61: UserWarning: Failed to load HostKeys from /home/runner/.ssh/known_hosts. You will need to explicitly load HostKeys (cnopts.hostkeys.load(filename)) or disableHostKey checking (cnopts.hostkeys = None).
warnings.warn(wmsg, UserWarning)
I have also tried to turn off hostkey, and load locally, but nothing seems to work.