Hi,
I am trying to use Pyvisa to automate testing. Issue I am having is that pyvisa.ResourceManager() is displaying multiple devices when infact there is only one device.
Here are the screen shots of my code and ouput:
Output:
Be sure to click 'more' and select 'suggest as answer'!
If you're the thread creator, be sure to click 'more' then 'Verify as Answer'!
Hi,
I am trying to use Pyvisa to automate testing. Issue I am having is that pyvisa.ResourceManager() is displaying multiple devices when infact there is only one device.
Here are the screen shots of my code and ouput:
Output:
For this reason, I wrote a helper, to inspect all ASRL devices with an IDN? command to see if they real SCPI devices or not.
Yeah I did the same.
Text for copy:
import pyvisa
rm = pyvisa.ResourceManager()
lr = rm.list_resources()
Valid_device =''
for i in lr:
## print(i)
try:
if 'GPIB' in i:
rm.open_resource(i)
print('Opening device#: ' + i)
Valid_device =i
except:
## print('Error not a real device')
break
print('Valid Device: ' + Valid_device)
Yeah I did the same.
Text for copy:
import pyvisa
rm = pyvisa.ResourceManager()
lr = rm.list_resources()
Valid_device =''
for i in lr:
## print(i)
try:
if 'GPIB' in i:
rm.open_resource(i)
print('Opening device#: ' + i)
Valid_device =i
except:
## print('Error not a real device')
break
print('Valid Device: ' + Valid_device)
the reason I had to fix this issue is if you are working with multiple PCs or devices, everytime you had to open NI Max or other app to find out the real device thats connected to your PC.
Now with this simple fix, your code is more portable among the PCs.
Thanks for Element14 community for prompt responses : )