0

我有一个 Keithley 2701 DMM,我正在尝试使用 python 2.7 和 pyVISA 通过 TCPIP 与它通信。我正在使用 virtualenv 和 wxPython 运行 python 2.7。我知道设备处于活动状态,因为我可以 ping IP 地址,我正在尝试使用以下代码访问机器:

from pyvisa.vpp43 import visa_library
visa_library.load_library("/Library/Frameworks/Visa.framework/VISA")
import visa import instrument
Keithley = visa.instrument("TCPIP::192.168.0.2::INSTR")

当我运行代码时,出现以下错误:

Traceback (most recent call last):
  File "Keithley.py", line 4, in <module>
    Keithley = visa.instrument("TCPIP::192.168.0.2::INSTR")
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyVISA-1.4-py2.7.egg/pyvisa/visa.py", line 294, in instrument
    return Instrument(resource_name, **keyw)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyVISA-1.4-py2.7.egg/pyvisa/visa.py", line 358, in __init__
    "lock")))
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyVISA-1.4-py2.7.egg/pyvisa/visa.py", line 132, in __init__
    keyw.get("lock", VI_NO_LOCK))
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyVISA-1.4-py2.7.egg/pyvisa/vpp43.py", line 753, in open
    byref(vi))
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyVISA-1.4-py2.7.egg/pyvisa/vpp43.py", line 398, in check_status
    raise visa_exceptions.VisaIOError, status
pyvisa.visa_exceptions.VisaIOError: VI_ERROR_RSRC_NFOUND: Insufficient location information or the requested device or resource is not present in the system.

任何帮助将不胜感激....

4

1 回答 1

2

我没有玩过这个特定的数字万用表,但我已经使用相同的设置连接到其他几个设备。

1) 检查您的文档/数字万用表以确保电路板编号实际上为零。否则,您需要更改以下行:

Keithley = visa.instrument("TCPIP::192.168.0.2::INSTR")

更像是

Keithley = visa.instrument("TCPIP1::192.168.0.2::INSTR")

2)尝试使用原始SOCKET连接而不是典型INSTR方法。

NI 插座示例

吉时利 2701 示例

如果我能想到其他任何事情,我会更新我的回复。

于 2012-05-29T02:54:05.533 回答