element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Experts, Learning and Guidance
  • Technologies
  • More
Experts, Learning and Guidance
Ask an Expert Forum PyVisa shows multiple devices when only one device is connected
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Experts, Learning and Guidance to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 7 replies
  • Answers 1 answer
  • Subscribers 286 subscribers
  • Views 2256 views
  • Users 0 members are here
  • pivisa
  • ask_the_expert
Related
See a helpful answer?

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'!

PyVisa shows multiple devices when only one device is connected

AdeelHAL123
AdeelHAL123 over 1 year ago

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: 

image

Output: 

image

  • Sign in to reply
  • Cancel

Top Replies

  • AdeelHAL123
    AdeelHAL123 over 1 year ago in reply to ggabe +3 suggested
    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…
  • AdeelHAL123
    AdeelHAL123 over 1 year ago in reply to AdeelHAL123 +2
    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…
  • ggabe
    ggabe over 1 year ago +1
    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.
Parents
  • ggabe
    0 ggabe over 1 year ago

    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. 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • AdeelHAL123
    0 AdeelHAL123 over 1 year ago in reply to ggabe

    Yeah I did the same. 

    image

    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)

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • AdeelHAL123
    0 AdeelHAL123 over 1 year ago in reply to AdeelHAL123

    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 : ) 

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • AdeelHAL123
    0 AdeelHAL123 over 1 year ago in reply to AdeelHAL123

    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 : ) 

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube