我正在使用Robot Framework SSHLibrary打开与RHEL服务器的连接。但连接不成功。 Robot Framework会引发以下错误
FAIL : UnicodeDecodeError: 'utf8' codec can't decode byte 0xa9 in position 660: invalid start byte
20151212 12:47:36.022 : DEBUG :
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\SSHLibrary\library.py", line 792, in login
return self._login(self.current.login, username, password, delay)
File "C:\Python27\lib\site-packages\SSHLibrary\library.py", line 832, in _login
login_output = login_method(username, *args)
File "C:\Python27\lib\site-packages\SSHLibrary\abstractclient.py", line 150, in login
return self._read_login_output(delay)
File "C:\Python27\lib\site-packages\SSHLibrary\abstractclient.py", line 165, in _read_login_output
return self.read(delay)
File "C:\Python27\lib\site-packages\SSHLibrary\abstractclient.py", line 299, in read
return self._decode(output)
File "C:\Python27\lib\site-packages\SSHLibrary\abstractclient.py", line 302, in _decode
return output.decode(self.config.encoding)
File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
答案 0 :(得分:0)
在打开连接中,Robot Framework关键字提供了 encoding = latin-1 ,因为我的登录响应中存在来自远程服务器的拉丁字符表示。 登录成功。