Programming Example: List connected VISA compatible resources using PyVISA

Posted on: June 18th, 2021 by James

PyVISA is a software library that enables Python applications to communicate with resources (typically instruments) connected to a controlling computer using different buses, including: GPIB, RS-232, LAN, and USB.

This example scans and lists the available resources.

It requires PyVISA to be installed (see the PyVISA documentation for more information)


#Example that scans a computer for connected instruments that
#are compatible with the VISA communication protocol.
#The instrument VISA resource ID for each compatible instrument
#is then listed.
#Python 3.4 32 bit
#PyVisa 1.7
#Rev 1: 08302018 JC

import visa

def main():

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

if __name__==’__main__’:



Here is the code:


And here is the result of a scan:

Each connected instrument returns a specific formatted string of characters called the VISA Resource ID.

The resource ID format is as follows:

‘Communication/Board Type (USB, GPIB, etc.)::Resource Information (Vendor ID, Product ID, Serial Number, IP address, etc..)::Resource Type’

In the response, each resource is separated by a comma. So, we have three resources listed in this example:

‘USB0::0x0483::0x7540::SPD3XGB4150080::INSTR’ – This is a power supply (SPD3X) connected via USB (USB0)

‘USB0::0xF4EC::0x1301::SVA1XEAX2R0073::INSTR’ – This is a vector network analyser (SVA1X) connected via USB (USB0)

‘TCPIP0::’ – This is an instrument connected via LAN using a TCPIP connection at IP address

Products Mentioned In This Article:

  • SPD3000 please see HERE
  • SVA1000X Series please see HERE