[問題] 請問paramiko讀取遠端big5問題
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname='192.168.1.1, port=22, username='root',
password='password', timeout=3)
command='df -h | awk \'NR>1\''
stdin, stdout, stderr = ssh.exec_command(command)
y = stdout.readlines()
for tmp in y:
print(tmp)
事情是這樣的 本機端是utf8 centos7環境 遠端是 big5 centos 5
這樣在print資訊的時候總是出現
nicodeDecodeError: 'utf-8' codec can't decode byte 0xa5 in position 19:
invalid start byte
不管如何encode 或 decode都沒辦法成功轉換
請問我要朝甚麼方向找答案 感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.124.109.173
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1536831037.A.9CB.html
推
09/13 21:22,
6年前
, 1F
09/13 21:22, 1F
→
09/14 09:26,
6年前
, 2F
09/14 09:26, 2F
→
09/14 09:27,
6年前
, 3F
09/14 09:27, 3F
推
09/14 11:01,
6年前
, 4F
09/14 11:01, 4F
→
09/14 13:01,
6年前
, 5F
09/14 13:01, 5F
推
09/14 13:34,
6年前
, 6F
09/14 13:34, 6F
→
09/14 13:34,
6年前
, 7F
09/14 13:34, 7F
感謝推薦 psutil 不過我的環境比較複雜 不想要每台被監測的系統都寫script
比較希望一台server去問資料回來解析
※ 編輯: phoenixcx (59.124.109.173), 09/14/2018 13:56:25
推
09/14 18:53,
6年前
, 8F
09/14 18:53, 8F
Python 近期熱門文章
PTT數位生活區 即時熱門文章