Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Pyvisa1.4 in Python3.2, a lot of unexpected errors generated

Previously I've used PyVisa1.4 in Python2.7, and everything works fine. Now I need to use Pyvisa1.4 in Python3.2.

I knew that some syntax are changed in Python3.2. Therefore I use the 2to3 to convert the originalPysiva .py files into the new format which are supposed to fit the Python3.2.

But now, unexpected error is generated which is related to ctypes. And I read through the Pyvisa package .py files and try to fix this but still don't know how to do deal with this.

I'm just trying to use the simple get_instruments_list() command like below:

>>> import visa
>>> get_instruments_list()
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    get_instruments_list()
  File "C:\Python32\Lib\site-packages\pyvisa\visa.py", line 254, in get_instruments_list
    vpp43.find_resources(resource_manager.session, "?*::INSTR")
  File "C:\Python32\Lib\site-packages\pyvisa\vpp43.py", line 581, in find_resources
instrument_description)
ctypes.ArgumentError: argument 2: <class 'TypeError'>: wrong type

The MAIN problem I'm facing now is how to correctly use PyVisa in Python3.2.


1 Answers

PyVISA 1.5 (which is in beta now) provides, among other things, full Python 3 support. Take a look at the (new) documentation for instructions about how to download the latest development version at http://pyvisa.readthedocs.org/

like image 72
Hernan Avatar answered Dec 06 '25 04:12

Hernan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!