Skip to content

Cannot locate GPIB library in PyVisa implementation #2

@WeAreGeth

Description

@WeAreGeth

Hello tivek,

Thank you for creating a gpib backend that I can use in PyVisa with PyVisa-py. The issue I am having relates to an inability to load the GPIB library. As given in your example, there is a function that can be called to have PyVisa recognize gpib_ctypes as the default GPIB module, but it seems not to be working for me.

My code:

from gpib_ctypes import make_default_gpib
make_default_gpib()

import visa as vi

connections=vi.ResourceManager('@py')
print(connections.list_resources()) #Error here

Error log:

  • /home/we-are-geth/.local/lib/python3.6/site-packages/gpib_ctypes/gpib/gpib.py:54: UserWarning: GPIB library not found. Please manually load it using _load_lib(filename). All GPIB functions will raise OSError until the library is manually loaded.
    warnings.warn(message)
    Traceback (most recent call last):
    File "/home/we-are-geth/Documents/PyVisa_Testing/Hello_World.py", line 7, in
    print(connections.list_resources())
    File "/home/we-are-geth/.local/lib/python3.6/site-packages/pyvisa/highlevel.py", line 1637, in list_resources
    return self.visalib.list_resources(self.session, query)
    File "/home/we-are-geth/.local/lib/python3.6/site-packages/pyvisa-py/highlevel.py", line 326, in list_resources
    for key, st in sessions.Session.iter_valid_session_classes()], [])
    File "/home/we-are-geth/.local/lib/python3.6/site-packages/pyvisa-py/highlevel.py", line 326, in
    for key, st in sessions.Session.iter_valid_session_classes()], [])
    File "/home/we-are-geth/.local/lib/python3.6/site-packages/pyvisa-py/gpib.py", line 56, in list_resources
    return ['GPIB0::%d::INSTR' % pad for pad in _find_listeners()]
    File "/home/we-are-geth/.local/lib/python3.6/site-packages/pyvisa-py/gpib.py", line 56, in
    return ['GPIB0::%d::INSTR' % pad for pad in _find_listeners()]
    File "/home/we-are-geth/.local/lib/python3.6/site-packages/pyvisa-py/gpib.py", line 34, in _find_listeners
    if gpib.listener(BOARD, i) and gpib.ask(BOARD, 1) != i:
    File "/home/we-are-geth/.local/lib/python3.6/site-packages/gpib_ctypes/gpib/gpib.py", line 417, in listener
    sta = _lib.ibln(board, pad, sad, ctypes.byref(present))
    File "/home/we-are-geth/.local/lib/python3.6/site-packages/gpib_ctypes/gpib/gpib.py", line 59, in f
    raise OSError(message)
    OSError: GPIB library not found. Please manually load it using _load_lib(filename). All GPIB functions will raise OSError until the library is manually loaded.
    [Finished in 0.3s with exit code 1]

Thank you for any assistance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions