I'm trying to connect to a GPIB instrument using pyVISA but I get an error. I'm following the simple example on the pyVISA website: http://pyvisa.readthedocs.org/en/master/
I type the following code into the IPython console:
import visa
rm = visa.ResourceManager()
rm.list_resources()
Out[4]:
(u'USB0::0x0957::0x0D0B::MY49431510::INSTR',
u'USB0::0x0957::0x17BC::MY52400338::INSTR',
u'ASRL1::INSTR',
u'ASRL2::INSTR',
u'ASRL5::INSTR',
u'ASRL6::INSTR',
u'ASRL7::INSTR',
u'ASRL8::INSTR',
u'ASRL9::INSTR',
u'ASRL10::INSTR')
However, my GPIB instruments do not show up, just the serial ports and my USB instruments. When I launch the Agilent Connection Expert (or NI MAX) I can see all my GPIB instruments and can communicate with them. I also am able to communicate with the instruments without issue with Matlab.
So when I try and connect to the instrument with the line:
inst = rm.open_resource('GPIB0::19::INSTR')
It throws an error:
VisaIOError: VI_ERROR_INTF_NUM_NCONFIG (-1073807195): The interface type is valid but the specified interface number is not configured.
I've also tried to connect with the USB instruments that show up when I list the resources and they do not throw this error. However, when I try and do a simple query:
inst = rm.open_resource('USB0::0x0957::0x0D0B::MY49431510::INSTR')
inst.query("*IDN?")
Nothing gets returned and no errors get thrown.
I'm using Python(X,Y) 2.7.9.0 with Python version 2.7.9 32 bit
pyVISA version is 1.6.3 NI bitness is 32
Any guidance is appreciated as I'm new to Python.
Thanks
You probably need to start the resource manager with:
rm = ResourceManager('Path to library')
where Path to library is the location of the NI Vista Library.
Also try:
python -m visa info
to ensure that you have it installed with the same word length as the python version that you are running.