Search code examples
pythontcpvisa

NI-VISA 5.1.2 + python 2.7 + OS 10.6.8 TCPIP ERROR


I have a Keithley 2701 DMM and I am trying to communicate with it via TCPIP using python 2.7 and pyVISA. I am running python 2.7 with virtualenv and wxPython. I know the device is active because I can ping the IP address, I am trying to access the machine using the following code:

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")

when I run the code I get the following error:

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.

Any help will be greatly appreciated....

V


Solution

  • I have not played with this particular DMM, but I have connected to several other devices using your same setup.

    1) Check your documentation / DMM to ensure that the board number is in fact zero. Otherwise you'll need to change the following line:

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

    To something more like

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

    2) Try to use a raw SOCKET connectional rather than the typical INSTR method.

    NI Socket Examples

    Keithley 2701 Examples

    If I can dream up anything else I will update my response.