Doing a fairly standard paramiko implementation returns decode error on readlines() for oddly formed text from remote command. I can not change the command output. How can I write the code to properly decode. See decode error text at bottom:
code snip being used:
connect = paramiko.SSHClient()
connect.connect(self.name,
username = self.ruser,
password = password,
key_filename = idkey,
timeout = 15,
)
stdin, stdout, stderr = connect.exec_command(cmd)
retval=stdout.channel.recv_exit_status()
stdin.flush()
stdout.flush()
stderr.flush()
out = stdout.readlines()
sys.exit()
ERROR TEXT:
File "../pylib/hosts/host.py", line 128, in cmd
out = stdout.readlines()
File "/usr/local/lib/python3.4/site-packages/paramiko/file.py", line 285, in readlines
line = self.readline()
File "/usr/local/lib/python3.4/site-packages/paramiko/file.py", line 270, in readline
return line if self._flags & self.FLAG_BINARY else u(line)
File "/usr/local/lib/python3.4/site-packages/paramiko/py3compat.py", line 148,
in u
return s.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 80: invalid continuation byte