From a0476d1bf2bcebb4dd4ecd3462420f6d3f2e6ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=A4berich?= Date: Mon, 12 Dec 2022 22:41:35 +0100 Subject: [PATCH] raise exception when error is returned by cmd --- Documentation/UserManual/SCPI_Examples/libreVNA.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/UserManual/SCPI_Examples/libreVNA.py b/Documentation/UserManual/SCPI_Examples/libreVNA.py index 9607183..32b9cae 100644 --- a/Documentation/UserManual/SCPI_Examples/libreVNA.py +++ b/Documentation/UserManual/SCPI_Examples/libreVNA.py @@ -82,7 +82,9 @@ class libreVNA: def cmd(self, cmd): self.sock.sendall(cmd.encode()) self.sock.send(b"\n") - self.__read_response() + resp = self.__read_response() + if len(resp) > 0: + raise Exception("Expected empty response but got "+resp) def query(self, query): self.sock.sendall(query.encode())