Open fuyouhan opened 2 weeks ago
--- Logging error --- Traceback (most recent call last): File "C:\Users\ruijie\AppData\Local\Programs\Python\Python38\lib\logging__init__.py", line 1084, in emit stream.write(msg + self.terminator) UnicodeEncodeError: 'gbk' codec can't encode character '\u0637' in position 2913: illegal multibyte sequence Call stack: File "C:\Users\ruijie\AppData\Local\Programs\Python\Python38\lib\threading.py", line 890, in _bootstrap self._bootstrap_inner() File "C:\Users\ruijie\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner self.run() File "C:\Users\ruijie\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run self._target(*self._args, self._kwargs) File "C:\Users\ruijie\AppData\Local\Programs\Python\Python38\lib\multiprocessing\pool.py", line 125, in worker result = (True, func(*args, *kwds)) File "C:\py\network\Network_Automatic_Inspect-main\网络自动化巡检工具20241025.py", line 312, in run_cmd output = conn.send_command(cmd) File "C:\py\network.venv\lib\site-packages\netmiko\utilities.py", line 500, in wrapper_decorator return func(self, args, kwargs) File "C:\py\network.venv\lib\site-packages\netmiko\base_connection.py", line 1533, in send_command new_data = self.read_channel() File "C:\py\network.venv\lib\site-packages\netmiko\base_connection.py", line 526, in read_channel output = self._read_channel() File "C:\py\network.venv\lib\site-packages\netmiko\base_connection.py", line 517, in _read_channel log.debug(f"read_channel: {output}") Message: 'read_channel: <> identify-application custom-group ҳӦ~route\r\r\n app-add WEBӦ\r\r\n app-add ƶWEBӦ\r\r\n app-add ̳PC\r\r\n app-add HTTP繺\r\r\n app-add HTTPϷ\r\r\n app-add WEB\r\r\n app-add ѶWEB\r\r\n app-add ͨҳϸ\r\r\n app-add ѶϷƽ̨\r\r\n app-add ѶϷȫ\r\r\n app-add Ϸ\r\r\n app-add ʱͨѶ\r\r\n app-add ļ\r\r\n app-add Զ̷Э\r\r\n app-add ʱͨѶ_MOBILE\r\r\n app-add 罻_MOBILE\r\r\n!\r\r\nidentify-application custom-group Ӧ~route\r\r\n app-add Ƶý\r\r\n app-add P2PӦ\r\r\n!\r\r\nidentify-application custom-group ƵӦ~route\r\r\n app-add HTTPƵ\r\r\n app-add Ƶ|Ӱ_MOBILE\r\r\n!\r\r\nidentify-application custom-group Ӧ~route\r\r\n app-add HTTP\r\r\n app-add HTTPϴ\r\r\n app-add \r\r\n app-add Ӳ\r\r\n app-add _MOBILE\r\r\n!\r\r\nidentify-application custom-group Ϸ~route\r\r\n app-add Ѷ\r\r\n app-add \r\r\n app-add ѺϷ\r\r\n!\r\r\nidentify-application custom-group QQȨӦ~route\r\r\n app-add Ӣ\r\r\n app-add Ӣ˵¼\r\r\n!\r\r\napp-proxy expect enable\r\r\nno ssl-audit mode\r\r\n!\r\r\nanti-pap set-node 0\r\r\nurl-filter-notice display 㱻ֹվϵվԱ\r\r\nno url-audit exact-filter\r\r\n!\r\r\ncontent-policy _AUDIT_DEFAULT\r\r\n!\r\r\n' Arguments: () 'gbk' codec can't encode character '\u0637' in position 2758: illegal multibyte sequence
Solution: Replace 'utf-8' keyword with "gbk" in the file _baseconnection.py** under netmiko.**
The file path on my enviroment:
C:\xx\xxx.venv\lib\site-packages\netmiko\base_connection.py
--- Logging error --- Traceback (most recent call last): File "C:\Users\ruijie\AppData\Local\Programs\Python\Python38\lib\logging__init__.py", line 1084, in emit stream.write(msg + self.terminator) UnicodeEncodeError: 'gbk' codec can't encode character '\u0637' in position 2913: illegal multibyte sequence Call stack: File "C:\Users\ruijie\AppData\Local\Programs\Python\Python38\lib\threading.py", line 890, in _bootstrap self._bootstrap_inner() File "C:\Users\ruijie\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner self.run() File "C:\Users\ruijie\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run self._target(*self._args, self._kwargs) File "C:\Users\ruijie\AppData\Local\Programs\Python\Python38\lib\multiprocessing\pool.py", line 125, in worker result = (True, func(*args, *kwds)) File "C:\py\network\Network_Automatic_Inspect-main\网络自动化巡检工具20241025.py", line 312, in run_cmd output = conn.send_command(cmd) File "C:\py\network.venv\lib\site-packages\netmiko\utilities.py", line 500, in wrapper_decorator return func(self, args, kwargs) File "C:\py\network.venv\lib\site-packages\netmiko\base_connection.py", line 1533, in send_command new_data = self.read_channel() File "C:\py\network.venv\lib\site-packages\netmiko\base_connection.py", line 526, in read_channel output = self._read_channel() File "C:\py\network.venv\lib\site-packages\netmiko\base_connection.py", line 517, in _read_channel log.debug(f"read_channel: {output}") Message: 'read_channel: <> identify-application custom-group ҳӦ~route\r\r\n app-add WEBӦ\r\r\n app-add ƶWEBӦ\r\r\n app-add ̳PC\r\r\n app-add HTTP繺\r\r\n app-add HTTPϷ\r\r\n app-add WEB\r\r\n app-add ѶWEB\r\r\n app-add ͨҳϸ\r\r\n app-add ѶϷƽ̨\r\r\n app-add ѶϷȫ\r\r\n app-add Ϸ\r\r\n app-add ʱͨѶ\r\r\n app-add ļ\r\r\n app-add Զ̷Э\r\r\n app-add ʱͨѶ_MOBILE\r\r\n app-add 罻_MOBILE\r\r\n!\r\r\nidentify-application custom-group Ӧ~route\r\r\n app-add Ƶý\r\r\n app-add P2PӦ\r\r\n!\r\r\nidentify-application custom-group ƵӦ~route\r\r\n app-add HTTPƵ\r\r\n app-add Ƶ|Ӱ_MOBILE\r\r\n!\r\r\nidentify-application custom-group Ӧ~route\r\r\n app-add HTTP\r\r\n app-add HTTPϴ\r\r\n app-add \r\r\n app-add Ӳ\r\r\n app-add _MOBILE\r\r\n!\r\r\nidentify-application custom-group Ϸ~route\r\r\n app-add Ѷ\r\r\n app-add \r\r\n app-add ѺϷ\r\r\n!\r\r\nidentify-application custom-group QQȨӦ~route\r\r\n app-add Ӣ\r\r\n app-add Ӣ˵¼\r\r\n!\r\r\napp-proxy expect enable\r\r\nno ssl-audit mode\r\r\n!\r\r\nanti-pap set-node 0\r\r\nurl-filter-notice display 㱻ֹվϵվԱ\r\r\nno url-audit exact-filter\r\r\n!\r\r\ncontent-policy _AUDIT_DEFAULT\r\r\n!\r\r\n' Arguments: () 'gbk' codec can't encode character '\u0637' in position 2758: illegal multibyte sequence