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

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.

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().

Related

Python 3 - selenium on xvfb-run- cannot process extension

I need to automate tasks to extract information from websites using the uBlock plugin with Chrome driver using the selenium module in Python 3.
I am running my code remotely without a GUI on the remote machine - for that I am using xvfb-run to simulate a desktop environment where Chrome launches with a specific window size.
The remote machine has the following Debian operating system:
uname -a
Linux mem 4.19.0-10-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64 GNU/Linux
These were the steps I took to configure my environment and code on the remote machine:
1 - To configure my environment, I installed this version of Google Chrome:
google-chrome --version
Google Chrome 86.0.4240.111
2 - Check the versions of Python 3 and selenium I installed:
python --version
Python 3.7.3
pip freeze
selenium==3.141.0
3 - Check the xvfb-run version:
apt-cache policy xvfb
2:1.20.4-1+deb10u1
4 - With these packages configured, I obtained the chromedriver_linux64.zip from this list (the version 86.0.4240.22 below is the most recent one that is the same major version of the installed google-chrome):
https://chromedriver.storage.googleapis.com/index.html
https://chromedriver.storage.googleapis.com/index.html?path=86.0.4240.22/
5 - To be able to use the uBlock extension of Chrome, I needed to install an extension that is able to produce a .crx archive file of other installed extensions.
For this, I used CRX Extractor/Downloader:
https://chrome.google.com/webstore/detail/crx-extractordownloader/ajkhmmldknmfjnmeedkbkkojgobmljda
6 - After using that extension, I got my ublock.crx file to test.
I managed to use the binary in chromedriver_linux64.zip without the extension to launch a Chrome instance and do some basic crawling.
But when I tried to use ublock.crx in my code, I got an exception.
The code was this:
This is the exception produced:
ublock.crx error
selenium.common.exceptions.SessionNotCreatedException: Message: session not
created: cannot process extension #1
from unknown error: cannot unzip
I am launching it from my program like this:
from selenium import webdriver
option = webdriver.ChromeOptions()
option.add_extension(ublock_crx_file_path)
driver = webdriver.Chrome(executable_path=driver_path, options=option)
I have made sure the path of ublock_crx_file_path is valid and points to the file I obtained from Chrome.
Hopefully someone can shed light on this?

Python stopped working on opening Jupiter notebook

System Details
Windows 7 32 Bit
After installing anaconda when i try to open any ipynb file in Jupyter notebook it opens a dialog box saying:
Python has stopped working
Following are the error details:
Problem signature: Problem Event Name: APPCRASH Application
Name: python.exe Application Version: 3.7.3150.1013 Application
Timestamp: 5c9ceaae Fault Module Name: KERNELBASE.dll Fault Module
Version: 6.1.7600.16385 Fault Module Timestamp: 4a5bdaae Exception
Code: 40000015 Exception Offset: 00009617 OS
Version: 6.1.7600.2.0.0.256.48 Locale ID: 1033 Additional
Information 1: 0a9e Additional Information
2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
If the online privacy statement is not available, please read our
privacy statement offline: C:\Windows\system32\en-US\erofflps.txt
I had the same problem. That took several days for me to find out my issue. I installed different versions of Anaconda and read many documents and performed many commands to upgrade but none of them resolved my problem. I think the Operating System (OS) version is not compatible with Anaconda's embedded python version (or Anaconda version). You can try different Operating System versions or different Anaconda versions. I found two versions of Anaconda which worked correctly (OS: Windows 7, 64 bit SP1). You can download them from the following link:
https://repo.anaconda.com/archive/
Anaconda3-5.3.1-Windows-x86_64.exe (Python version: 3.7.0)
Anaconda2-5.3.1-Windows-x86_64.exe (Python version: 2.7)
Because you use OS: WIN 7, 32 bit, you can download the 32-bit version of the above Anaconda.

hcidump binary not found

I'm setting up the BlueZ protocol stack on a custom system using linux 3.3. I'm using buildroot to setup the filesystem, and specifically am using BlueZ-4.101.
I'm attempting to use the hcidump utility to get some logs, but the binary has not been installed.
I've checked that:
Device driver is installed in kernel
BlueZ Utils is enabled in buildroot .config file
Other utilities work, such as hcitool or hciconfig
Going into the Makefile in output/build/bluez_utils-4.101 it would appear that the object file hcidump.o is being compiled into a binary called btmon.
Further investigation would reveal that in Makefile, btmonis assigned to am__EXEEXT_10, and that is then assigned to the variable noinst_PROGRAMS.
So this is where I'm at. I'm pretty sure that this is an automatically generated Makefile by buildroot. I'm not sure how these files are generated, thus I'm unsure as to why btmon is being assigned to the noinst_PROGRAMS variable.
In summary, I believe that my version of BlueZ uses a binary btmon instead of hcidump. btmon is compiled (binary seen at output/build/bluez_utils-4.101/monitor/btmon), but not being installed onto my target system because of instructions in Makefile.
My best guess would something weird about compatibility between my kernel version and bluez. Any suggestions would be greatly appreciated!
In BlueZ 4, hcidump was distributed as a separate package, bluez-hcidump. This has never been packaged in buildroot, however. So either create your own package for bluez-hcidump, or switch to BlueZ 5. BleuZ 5 is provided by buildroot starting from 2014.08.

Linux Kernel Modules between different kernel patches

I am running into a issue with RH7 kernels. We are running RH6/Centos6 based systems - we normally compile the kernel module once (Centos6.6) and we could install the kernel module on another Centos kernel in the same series (say Centos6.4).
With Centos7 (3.10 kernel) I cannot build the kernel module with says 3.10.0-329 (Centos7.2) kernel and install on a kernel version 3.10.0-227 (Centos7.1) - insmod returns invalid format.
Anyone run into similar issues - are there any workarounds.
Thanks
--
Jimmy
Probably, you want a binary blob - ready-made object file which is part of the module. Look into kernel documentation for know how to build module which uses binary blobs. – Tsyvarev

USRP_UHD version installed with REDHAWK

I installed REDHAWK 1.10.1 on CentOS 6.6, and as part of 1.10.1, there is a USRP_UHD device. It seems, as part of the REDHAWK install, the Ettus USRP_UHD driver (v3.5.3) is installed as well since I am able to run utilities such as uhd_usrp_probe. These utilities are located in /usr/bin, however, there should be some examples included with the driver as well.
I installed the USRP_UHD driver (v3.8.2) on my OS X laptop as a test, and I have the usual utilities (uhd_usrp_probe, etc.) and also I have examples such as benchmark_rate which is helpful is troubleshooting (http://www.ettusresearch.com/content/files/kb/application_note_uhd_examples.pdf). In OS X, these files are located in /opt/local/share/uhd/.
I can not find these examples in CentOS. Does REDHAWK not install them? How can I install them as they seem like they could be useful?
The uhd package provided by the REDHAWK yum repo is modeled off of the Fedora spec file of the uhd package. They have chosen to remove the examples and tests folder from the built product prior to packaging it. See line 84 and 85 from the uhd spec file shown here from the Fedora 19 branch.
This removal of the examples and tests directories goes back all the way to the initial check in of the spec file so it is unclear why this decision was made.
To get these binaries, you could build the uhd drivers from source. See the UHD build guide for information on how to build the UHD driver from source.

Resources