Search code examples
pythonctypesvisa

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.


Solution

  • The newest version of Pyvisa doesn't support Python3.2

    Even thouhg you convert the syntax of Pyvisa1.4 for Python2.X to Python3.X by using 2to3 tool, it still won't work