NI-VISA 5.1.2 + python 2.7 + OS 10.6.8 TCPIP错误

时间:2012-05-29 01:09:59

标签: python tcp visa

我有一台Keithley 2701数字万用表,我正在尝试使用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.

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

V

1 个答案:

答案 0 :(得分:1)

我没有使用过这个特殊的DMM,但是我使用相同的设置连接了其他几个设备。

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

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

更喜欢

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

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

NI Socket Examples

Keithley 2701 Examples

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