Я получил следующую ошибку при использовании декодирования.UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9d in position 0: invalid start byte
import pysftp
import paramiko
from paramiko.py3compat import decodebytes
keydata = b"""4049a539f13cba06a874c4b6aadd0cc4"""
key = paramiko.RSAKey(data=decodebytes(keydata))
cnopts = pysftp.CnOpts()
cnopts.hostkeys.add('xxx.www.it', 'ssh-rsa', key)
with pysftp.Connection('xxx.www.it', username='google', password='xxx', cnopts=cnopts) as sftp:
sftp.get('remote_file')
Я использую Python 3.5.
Это Traceback.
Traceback (most recent call last):
File "test.py", line 7, in <module>
key = paramiko.RSAKey(data=decodebytes(keydata))
File "/home/asd/workstation/Python/env3/lib/python3.5/site-packages/paramiko/rsakey.py", line 65, in __init__
cert_type="ssh-rsa-cert-v01@openssh.com",
File "/home/asd/workstation/Python/env3/lib/python3.5/site-packages/paramiko/pkey.py", line 397, in _check_type_and_load_cert
type_ = msg.get_text()
File "/home/asd/workstation/Python/env3/lib/python3.5/site-packages/paramiko/message.py", line 178, in get_text
return u(self.get_string())
File "/home/asd/workstation/Python/env3/lib/python3.5/site-packages/paramiko/py3compat.py", line 156, in u
return s.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9d in position 0: invalid start byte