From ff8759fb88d9f4bab09dcf621d311a6cf0735acc Mon Sep 17 00:00:00 2001 From: kanjoe24 <165808281+kanjoe24@users.noreply.github.com> Date: Thu, 14 Aug 2025 09:58:32 +0000 Subject: [PATCH 1/3] Fix : gh #485 : Fix codec cant decode byte error in device settings tests audio --- framework/core/commandModules/sshConsole.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/core/commandModules/sshConsole.py b/framework/core/commandModules/sshConsole.py index e3b1ed5..4b60b27 100644 --- a/framework/core/commandModules/sshConsole.py +++ b/framework/core/commandModules/sshConsole.py @@ -103,7 +103,7 @@ def read_until(self, value, timeout=10) -> str: while time.time() < end_time: if self.shell.recv_ready(): - output += self.shell.recv(4096).decode('utf-8') + output += self.shell.recv(4096).decode('utf-8', errors='ignore') # Reset the timeout if new data is received end_time = time.time() + timeout From 907e43bf1763891e5fbb22879defa434fbf3e6c5 Mon Sep 17 00:00:00 2001 From: kanjoe24 <165808281+kanjoe24@users.noreply.github.com> Date: Thu, 14 Aug 2025 12:09:40 +0000 Subject: [PATCH 2/3] Add : gh #485:Adding a try catch block to handle this issue rather than ignore --- framework/core/commandModules/sshConsole.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/framework/core/commandModules/sshConsole.py b/framework/core/commandModules/sshConsole.py index 4b60b27..779895e 100644 --- a/framework/core/commandModules/sshConsole.py +++ b/framework/core/commandModules/sshConsole.py @@ -103,7 +103,14 @@ def read_until(self, value, timeout=10) -> str: while time.time() < end_time: if self.shell.recv_ready(): - output += self.shell.recv(4096).decode('utf-8', errors='ignore') + try: + # Read the output from the shell + raw_output = self.shell.recv(4096) + output += raw_output.decode('utf-8', errors='strict') + except UnicodeDecodeError as e: + self.log.critical(f"UnicodeDecodeError - {e}") + # Fallback to safer decoding of the same raw data without crashing + output += raw_output.decode('utf-8', errors='replace') # Reset the timeout if new data is received end_time = time.time() + timeout From bcfdb4b30daba1674da4fffa12efde256417caf4 Mon Sep 17 00:00:00 2001 From: kanjoe24 <165808281+kanjoe24@users.noreply.github.com> Date: Thu, 14 Aug 2025 12:16:22 +0000 Subject: [PATCH 3/3] Revert : gh #485 : Reverting the decode command back to original --- framework/core/commandModules/sshConsole.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/core/commandModules/sshConsole.py b/framework/core/commandModules/sshConsole.py index 779895e..3742750 100644 --- a/framework/core/commandModules/sshConsole.py +++ b/framework/core/commandModules/sshConsole.py @@ -106,7 +106,7 @@ def read_until(self, value, timeout=10) -> str: try: # Read the output from the shell raw_output = self.shell.recv(4096) - output += raw_output.decode('utf-8', errors='strict') + output += raw_output.decode('utf-8') except UnicodeDecodeError as e: self.log.critical(f"UnicodeDecodeError - {e}") # Fallback to safer decoding of the same raw data without crashing