EESEPT
EESEPT

Reputation: 1

PyVISA GPIB functions will raise OSError until the library is manually loaded

I am trying to connect a new open source VNA, or Vector Network Analyzer, (LibreVNA) via USB to be able to automate some readings. I have run into a problem trying to connect to the device via PyVISA. I cannot get access to the SCPI commands as the PyVISA results in the error below and two 'ASRL/dev/ttyS0::INSTR' devices that are not the open source VNA.

When I run python3 -m visa info:

/usr/local/lib/python3.8/dist-packages/visa.py:13: FutureWarning: The visa module provided by PyVISA is being deprecated. You can replace `import visa` by `import pyvisa as visa` to achieve the same effect.

The reason for the deprecation is the possible conflict with the visa package provided by the https://github.com/visa-sdk/visa-python which can result in hard to debug situations.
  warnings.warn(
/usr/local/lib/python3.8/dist-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)
Machine Details:
   Platform ID:    Linux-5.11.0-25-generic-x86_64-with-glibc2.29
   Processor:      x86_64

Python:
   Implementation: CPython
   Executable:     /usr/bin/python3
   Version:        3.8.10
   Compiler:       GCC 9.4.0
   Bits:           64bit
   Build:          Jun  2 2021 10:49:15 (#default)
   Unicode:        UCS4

PyVISA Version: 1.11.3

Backends:
   ivi:
      Version: 1.11.3 (bundled with PyVISA)
      Binary library: Not found
   py:
      Version: 0.5.2
      ASRL INSTR: Available via PySerial (3.5)
      USB INSTR: Available via PyUSB (1.2.1). Backend: libusb1
      USB RAW: Available via PyUSB (1.2.1). Backend: libusb1
      TCPIP INSTR: Available 
      TCPIP SOCKET: Available 

From my previous attempts I have tried to add the library of GPIB-ctypes and that's when the error is added. I get an error about not being able to find module named 'gpib' without adding the gpib-ctypes library.

Upvotes: 0

Views: 2968

Answers (1)

bfris
bfris

Reputation: 5815

If you look at the SCPI examples for this device you'll see that SCPI communications is actually done via a TCP port (19542 is the default). Furthermore, the GUI must be running and SCPI communications has to be enabled in the GUI. It seems that the GUI runs a small SCPI server. This is approach is commonly used with much more expensive USB Network Analyzers (e.g. Keysight and Textronix).

According to PyVisa docs, you should be able to use this syntax for the device string to connect:

TCPIP::localhost::19542::SOCKET

or

TCPIP::127.0.0.1::19542::SOCKET

I don't know if any of the VISA libraries will be able to discover this device via rm.list_resources().

Upvotes: 1

Related Questions