pythonpyvisa

PyVISA - AttributeError: 'NIVisaLibrary' object has no attribute 'viParseRsrcEx'


I'm trying to connect to equipment Chroma 63600 using this code:

import visa
rm = visa.ResourceManager()
print rm.list_resources()
my_instrument = rm.open_resource(u'USB2::0x0a69::0x083e::636005000984')
print(my_instrument.query('*IDN?'))

But it returns the error:

/root/PycharmProjects/Teste/venv/bin/python /root/PycharmProjects/Teste/Teste.py
(u'USB2::0x0a69::0x083e::636005000984',)
Traceback (most recent call last):
  File "/root/PycharmProjects/Teste/Teste.py", line 4, in <module>
    my_instrument = rm.open_resource(u'USB2::0x0a69::0x083e::636005000984',)
  File "/root/PycharmProjects/Teste/venv/local/lib/python2.7/site-packages/pyvisa/highlevel.py", line 1634, in open_resource
    info = self.resource_info(resource_name, extended=True)
  File "/root/PycharmProjects/Teste/venv/local/lib/python2.7/site-packages/pyvisa/highlevel.py", line 1594, in resource_info
    ret, err = self.visalib.parse_resource_extended(self.session, resource_name)
  File "/root/PycharmProjects/Teste/venv/local/lib/python2.7/site-packages/pyvisa/ctwrapper/functions.py", line 1380, in parse_resource_extended
    ret = library.viParseRsrcEx(session, resource_name, byref(interface_type),
AttributeError: 'NIVisaLibrary' object has no attribute 'viParseRsrcEx'

Process finished with exit code 1 

I'm using Ubuntu 16.04, PyCharm with Python 2.7 interpreter and I've already imported this libraries:

libraries

Maybe this information helps: the command "python -m visa info" returns:

pyvisa info


Solution

  • This looks like a problem with the VISA backend. If you're intending to use PyVISA-py as the backend, you have to select it first. Change rm = visa.ResourceManager() to rm = visa.ResourceManager('@py').