PyVISA missing methods

风流意气都作罢 提交于 2019-12-11 17:55:01

问题


I am running Win 7 x64, NI 488.2, PyVISA 1.5, and python with numpy/scipy/ipython. I am attempting to contact a Keithley instrument through a GPIB-USB connection and send simple commands. However, when I attempt to create the instrument object, I discovered that PyVISA's ResourceManager was missing the required methods used for finding, reading, and writing to instruments.

Following the example code on PyVISA's page, right now I have:

import visa
rm = visa.ResourceManager
my_instrument = rm.get_instrument('GPIB::3')

Which returns an error that get_instrument doesn't exist. Using tab-completion to see what is available from the resource manager rm. reveals that it is lacking virtually all the methods it should have, containing only rm.init, rm.close, and a few others. These all either do nothing or return a 4099L. Attempting to call rm itself just prints the string 'ResourceManager()'.

Upon further examination, visa.VisaLibrary() is nowhere to be found, suggesting the problem is a botched installation; however, upon redownloading and reinstalling the entire package (using pip), the missing file problem persists. The visa module itself loads fine, it's just missing most of its important files. Am I screwing up the installation, or is there something else going on?


回答1:


From past experience you might need to tell pyvisa where the visa library is eg NI VISA + pyVisa on Mac OS X (Snow Leopard) However, I havent used 1.5 yet

If that fails, 1.4 works fine on Win 7x64




回答2:


Turns out the answer was as simple as downloading the package from a different location. Apparently the site I used had a corrupted or incomplete package up for DL.



来源:https://stackoverflow.com/questions/24047384/pyvisa-missing-methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!