pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed - due to OPC? command

57 Views Asked by At

Im using Kesight oscilloscope, and suddenly I start getting pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339).

it occured always due to the same line in my code "self._rm.query('*OPC?')"

this is how I confige the class

class Scope:
def __init__(self, ip: str,USBaddress: str = ''):
    self._ip = ip
    self._USBaddress = USBaddress
    if self._USBaddress == '':
        self._resource = f'TCPIP0::{ip}::INSTR'
    else:
        self._resource = f'USB0::{USBaddress}::0::INSTR'
    self._rm = resource_manager.open_resource(self._resource)
    self._rm.timeout = 1000

    self.id = self._rm.query('*IDN?')

    self.config = Config(self._rm, self)
    self.screen = Screen(self._rm, self)
    self.markers = Markers(self._rm, self)
    self.trigger = Trigger(self._rm, self)
    self.save_file = Save_Files(self._rm)
    self.measurements = Measurements(self._rm, self)
    self.jitter = Jitter(self._rm, self)
    self.functions = Functions(self._rm, self)

and for example - Im trying to change horizontal position by the following fucntion :

def horizontal_position(self, position: float):
    """
        The :TIMebase:POSition command sets the time interval between the trigger event
        and the delay reference point. The delay reference point is set with the
        :TIMebase:REFerence command.
    :param position:A real number for the time in seconds from trigger to the delay reference point.
    :return:None
    """
    self._rm.write(f':TIMebase:POSition {position}')
    self._rm.query('*OPC?')

and the line self._rm.query('*OPC?') rise the error VI_ERROR_TMO (-1073807339)

any idea why ?

Thanks is advance.

0

There are 0 best solutions below