AttributeError: 'module' object has no attribute 'get_instruments_list'

2677 views python
-1

I use Windows 10 and Python 2.7.

When I use the get_instruments_list() function of the visa module, an error occurs.

insts = [inst for inst in visa.get_instruments_list() if 'GPIB' in inst]

error:

insts = [inst for inst in visa.get_instruments_list() if 'GPIB' in inst]
AttributeError: 'module' object has no attribute 'get_instruments_list'

answered question

1 Answer

4

get_instruments_list() is from PyVISA 1.5 You need to change this to something like:

import visa
rm = visa.ResourceManager()
rm.list_resources()

So your code could be changed to:

insts = [inst for inst in visa.ResourceManager().list_resources() if 'GPIB' in inst]

posted this

Have an answer?

JD

Please login first before posting an answer.