PyVisa and Agilent 823578 on Mac

1.5k Views Asked by At

I am trying to get PyVisa working on my mac. I have installed it and NI libraries but when I try to run the following simple python file from terminal in VS code:

import sys
import pyvisa as visa
rm = visa.ResourceManager()
rm.list_resources()

inst = rm.open_resources('GPIB::10::INSTR') #Instrument GPIB Addr = 10
print (inst.query("*IDN?"))

By running 'python3 temp.py' I get the following error message:

Error Domain=KMErrorDomain Code=71 "Insufficient permissions for action: Unable to load 'com.highpoint-tech.kext.HighPointRR' in unprivileged request." UserInfo={NSLocalizedDescription=Insufficient permissions for action: Unable to load 'com.highpoint-tech.kext.HighPointRR' in unprivileged request.}
zsh: abort      python3 temp.py
2

There are 2 best solutions below

1
Igor Shturma On BEST ANSWER

Make sure com.ni.driver.NiViPciK extension is installed and loaded. For this, go to About This Mac -> System Report -> Extensions (in Software section) and find NiViPciK. It will likely say "Loaded: No". You need to manually allow National Instruments extensions.

  1. Boot into recovery mode by holding Cmd-R while powering up.
  2. Open Terminal from Tools menu.
  3. Execute: spctl kext-consent add SKTKK2QZ74
  4. Reboot

This did the trick for me: enter image description here

0
lev5 On

I have been using NI IVI backend, but lately gave a spin to open source PyVISA-py backend instead and it has worked great for our automation purposes both on OSX and Linux.

I changed rm = visa.ResourceManager() to rm = visa.ResourceManager('@py'). Some minor modifications may be needed (I had to remove instrument.clear() calls for some reason).