Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VI_ERROR_LIBRARY_NFOUND Mac OS X 10.6.6

Solved!
Go to solution

I am currently trying to use a NI GPIB-USB-HS coupled with pyVisa (Python) on my Macbook Pro running Snow Leopard.  I have not seen any posts with in the last year of people having issues with Snow Leopard, so I believe that I might be doing something wrong.



So far I have installed the latest version of NI VISA for OS X (version 5.0).  This produced zero errors.

I have installed pyVisa.  I am able to import modules from pyvisa, so I am fairly confident that it is alright.

I am able to import visa from pyVisa.  Doing dir(visa) gives the full list of modules available.

The errors come when I try to call the Instrument("GPIB::17") command.  It gives me a trace back with this error code being the last error: VI_ERROR_LIBRARY_NFOUND



The code I have used to produce this error is copied below.  Any help on this would be greatly appreciated!



--Adam



CODE SNIPPET:



from pyvisa.vpp43 import visa_library

visa_library.load_library("/Library/Frameworks/VISA.framework/Versions/A/VISA")

import visa

ps = visa.Instrument("GPIB::17")



Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/aclewis/.envs/TIDE29/lib/python2.7/site-packages/PyVISA-1.3-py2.7.egg/pyvisa/visa.py", line 358, in __init__
    "lock")))
  File "/Users/aclewis/.envs/TIDE29/lib/python2.7/site-packages/PyVISA-1.3-py2.7.egg/pyvisa/visa.py", line 132, in __init__
    keyw.get("lock", VI_NO_LOCK))
  File "/Users/aclewis/.envs/TIDE29/lib/python2.7/site-packages/PyVISA-1.3-py2.7.egg/pyvisa/vpp43.py", line 753, in open
    byref(vi))
  File "/Users/aclewis/.envs/TIDE29/lib/python2.7/site-packages/PyVISA-1.3-py2.7.egg/pyvisa/vpp43.py", line 398, in check_status
    raise visa_exceptions.VisaIOError, status
pyvisa.visa_exceptions.VisaIOError: VI_ERROR_LIBRARY_NFOUND: A code library required by VISA could not be located or loaded.

 

0 Kudos
Message 1 of 3
(8,901 Views)
Solution
Accepted by topic author aclewis182

Hi aclewis, 

 

Are you able to call GPIB in Measurement and Automation explorer? If you can find this out, we can narrow down if it is a problem with pyVisa or simply connecting to the device in general. Secondly, it seems that you are having the same problem as in this case: 

http://decibel.ni.com/content/docs/DOC-13584

Is this accurate? 

 

Some other resources that may help are as follows:

http://ubuntuforums.org/showpost.php?p=9059215&postcount=4

http://decibel.ni.com/content/docs/DOC-6742

 

Try to call this device without Python and see if this works. Good luck!


Regards,

Jackie

DAQ Product Marketing Engineer
National Instruments
0 Kudos
Message 2 of 3
(8,881 Views)

It turns out everything is working as expected.  The issue was not including the 0 in the device id.  Meaning that the call to "GPIB::17" should have been "GPIB0::17".  I found this by trial and error based on your recommendations.

 

 

Thanks for the help!

0 Kudos
Message 3 of 3
(8,870 Views)