3

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
Landon
  • 528
  • 2
  • 4
  • 22

2 Answers2

2

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

Reza Rahemtola
  • 1,182
  • 7
  • 16
  • 30
1

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

lev5
  • 141
  • 6