Сurrently I have two physically connected devices, but the scan result shows me other devices that were previously connected, but are not physically connected now. Please tell me how I can remove them from the list or where they are stored?
Another problem is that physically connected devices are duplicated by the connection address, with a single difference "...::serial_number::INSTR" and "...::serial_number::0::INSTR" (extra 0 before ::INSTR).
I browsed a lot of pages on the Internet, and tried restarting the computer, devices, reinstalling the PyVISA, the .close() command, but I still didn't get the desired result. Could someone please help with it?
Thanks in advance
Code:
import pyvisa
rm = pyvisa.ResourceManager()
equipment = rm.list_resources()
for i in range(len(equipment)):
print(equipment[i])
Result:
USB0::0x0000::0x0000::::INSTR
USB0::0x0957::0x2307::MY50000279::INSTR
USB0::0x0957::0x1734::MY44002738::INSTR
ASRL3::INSTR
TCPIP0::169.254.5.21::inst0::INSTR
USB0::0x0699::0x0365::C030691::0::INSTR
USB0::0x0957::0x1734::MY44002738::0::INSTR
USB0::0x0957::0x1734::MY44003547::0::INSTR
USB0::0x0957::0x1775::MY49460204::0::INSTR
USB0::0x0957::0x17B4::MY57310459::0::INSTR
USB0::0x0957::0x2307::MY50000279::0::INSTR
I use: Windows 10, Python 3.11.2, PyVISA 1.13.0
PyVISA is a wrapper for the VISA architecture. Thus, the documentation for PyVISA’s ResourceManager class doesn’t reveal anything about how to manipulate the list of resources that it generates, including removal of items from the list. In the past, I’ve had luck using software like Keysight Connection Expert to see the list of resources that are available and to remove old connections.
Alternatively, you could use the NI MAX VISA Alias Utility (or a similar installed VISA utility) to handle this.