question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[COM] Communication issue with Agilent 33250A using pyvisa

See original GitHub issue

I am using pyvisa to connect to 33250A, however it works not well. The code shown below worked well for Agilent 2700.

import pyvisa
rm = pyvisa.ResourceManager()
print(rm.list_resources())
inst = rm.open_resource(u'GPIB0::10::INSTR')
print(inst.query("*IDN?"))

The error is occurred line 4 ,

rm.open_resource(u'GPIB0::10::INSTR')

The detail is shown below,

Traceback (most recent call last):
  File "C:/Users/56942/PycharmProjects/NI-instruments/main.py", line 4, in <module>
    inst = rm.open_resource(u'GPIB0::10::INSTR')
  File "C:\Users\56942\PycharmProjects\NI-instruments\venv\lib\site-packages\pyvisa\highlevel.py", line 3271, in open_resource
    info = self.resource_info(resource_name, extended=True)
  File "C:\Users\56942\PycharmProjects\NI-instruments\venv\lib\site-packages\pyvisa\highlevel.py", line 3197, in resource_info
    ret, err = self.visalib.parse_resource_extended(self.session, resource_name)
  File "C:\Users\56942\PycharmProjects\NI-instruments\venv\lib\site-packages\pyvisa\ctwrapper\functions.py", line 2089, in parse_resource_extended
    for val in (resource_class, unaliased_expanded_resource_name, alias_if_exists)
  File "C:\Users\56942\PycharmProjects\NI-instruments\venv\lib\site-packages\pyvisa\ctwrapper\functions.py", line 2089, in <listcomp>
    for val in (resource_class, unaliased_expanded_resource_name, alias_if_exists)
  File "C:\Users\56942\PycharmProjects\NI-instruments\venv\lib\site-packages\pyvisa\ctwrapper\types.py", line 74, in buffer_to_text
    return buf.value.decode("ascii")
    
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)
('GPIB0::10::INSTR',)

Process finished with exit code 1

and it works well by using connect expert

image-20201206004938348

Output of pyvisa-info

Machine Details:

Platform ID: Windows-10-1909 Processor: Intel® Core™ i5-4200M CPU @2.5GHz 2.49GHz

Python:

Interpreter: Python 3.7.3 PyVISA Version: 1.11.3 NI version: NI-488.2 18.5

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MatthieuDartiailhcommented, Dec 9, 2020

I assume you are using a Keysight USB to GPIB adapter. This kind of adapter can only be used in conjunction with the adapter manufacturer VISA implementation. You could also try to use the Keysight VISA conflict manager (In connection expert look under Tools, and specify to use Keysight VISA for GPIB resources, it may solve your issue without having to explicitly pass the path to the dll.

0reactions
HaoLiuwidecommented, Dec 9, 2020

Thank you for your advice. The problem is related to the two type of VISA. I solved the problem by

import pyvisa as visa

# rm = visa.ResourceManager()
rm = visa.ResourceManager('C:/Program Files (x86)/IVI Foundation/VISA/WinNT/agvisa/agbin/visa32.dll')

print(rm.list_resources())
my_2612A = rm.open_resource('GPIB0::10::INSTR')  
print(my_2612A.query('*IDN?'))

Although the problem was solved, I have some questions. If I have only NI-VISA installed, my computer could not recognize GPIB devices in the Measurement & Automation Explorer. Only if both NI-VISA and Keysight VISA were installed, my computer worked well.

image-20201209220412342 image-20201209220639837

Read more comments on GitHub >

github_iconTop Results From Across the Web

PyVISA mac OS X (Mountain Lion) Agilent 33250a
I am having trouble connecting to an Agilent 33250a instrument using a GPIB-USB controller. Does anybody have any ideas how I can get...
Read more >
AgilentPython/agilent_python3.py at master - GitHub
Wrapper over pyvisa for remote control of Agilent 33250A ... Class for communicating with Agilent Arbitrary Waveform Generator 33250A.
Read more >
Issue with arbitrary waveform and Agilent 33250A
Dear all, I'm fighting with the communication protocol between my VIs and an Agilent 33250A (manual here ). I'm thus seeking for help....
Read more >
Agilent 33250A User's Guide - RS Components
The Agilent Technologies 33250A is a high-performance 80 MHz synthesized function generator with built-in arbitrary waveform and pulse capabilities. Its ...
Read more >
34401A GPIB VISA TIME OUT ERRORS - Keysight Community
It is Windows XP 2000 SP3. I still use VB6 and VBA to program test software. The problem also occurs with the Agilent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found