python - 简单的*IDN?查询结果为 "Timeout expired before operation completed"

标签 python visa pyvisa

我尝试通过以下方式对我的 LAB 仪器进行简单查询:

>>> import visa
>>> rm = visa.ResourceManager()
>>> viavi = rm.open_resource("TCPIP0::10.0.2.76::5001::SOCKET")
>>> print(viavi.query("*IDN?"))

结果是:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python35\lib\site-packages\pyvisa\resources\messagebase
d.py", line 407, in query
    return self.read()
  File "C:\Program Files\Python35\lib\site-packages\pyvisa\resources\messagebase
d.py", line 332, in read
    message = self.read_raw().decode(enco)
  File "C:\Program Files\Python35\lib\site-packages\pyvisa\resources\messagebase
d.py", line 306, in read_raw
    chunk, status = self.visalib.read(self.session, size)
  File "C:\Program Files\Python35\lib\site-packages\pyvisa\ctwrapper\functions.p
y", line 1582, in read
    ret = library.viRead(session, buffer, count, byref(return_count))
  File "C:\Program Files\Python35\lib\site-packages\pyvisa\ctwrapper\highlevel.p
y", line 188, in _return_handler
    raise errors.VisaIOError(ret_value)
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before op
eration completed.

根据我到目前为止所学到的(来自其他人的经验)。此超时错误在某种程度上与行终止(“\n”)有关。我该如何解决这个问题?

最佳答案

我发现这一切都与read_termination有关。我的 LAB 仪器只是通过“\n”终止其响应。 虽然我的脚本一直在寻找 '\r'。

关于python - 简单的*IDN?查询结果为 "Timeout expired before operation completed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42688226/

相关文章:

python - pyvisa 给出错误,但 linux-gpib 工作

python - Keithley 2410 Pymeasure NotImplementedError : Please upgrade PyVISA to version 1. 8 或更高版本

python - PyVISA SerialInstrument 失败后需要硬重置才能连接

python - 无法获得包含序列号的完整 VISA 地址

Python Tkinter 浏览文件 - 问题

python - Python 列表中唯一项的数量

python - 导入错误 : No module named

python - 将行附加到空 DataFrame 将 dtype 从 int 转换为 object

python - Keras 中局部连接层的维度

python - 是PyVISA安装失败吗?或者,我做错了什么吗?