Commit 7a6344a3 authored by Simon Sebastian Humpohl's avatar Simon Sebastian Humpohl
Browse files

Add an empty read after each send_cmd if a simulator was detected.

parent 05a2144b
......@@ -38,7 +38,7 @@ import numpy as np
from pyvisa import ResourceManager
import pyvisa.constants as vc
__version__ = '1.0.1'
__version__ = '1.0.2'
__revision__ = '$Rev: 4238 $'
__docformat__ = 'reStructuredText'
......
......@@ -356,6 +356,8 @@ class TEWXAwg(object):
if self._instr_addr is not None:
self.open()
self._simulator_read_workaround = self.is_simulator
def __enter__(self):
return self
......@@ -474,6 +476,11 @@ class TEWXAwg(object):
paranoia_level = self._paranoia_level
pytabor.send_cmd(self._visa_inst, cmd_str, paranoia_level)
if self._simulator_read_workaround and paranoia_level == 0:
empty_str = self._visa_inst.read()
assert empty_str == '', ("This workaround expects an empty response after each command that is not a query."
" The simulator does this in some versions. It is controlled by the attribute "
"_simulator_read_workaround. Actual response was: %r" % empty_str)
def send_query(self, query_str):
'''Send the given query to the instrument and read the response
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment