01-06-2022 02:15 AM
HI:
I use Python v3.8 or 32bit version, always unable to run. report errors:
#####################
Traceback (most recent call last):
File "d:/RomeB0/pc_romeb0_cfgtool_lib_1020/AT_95_pi_zerodelay.py", line 261, in <module>
vi1=(visa.VISA_Open(b'TCPIP0::192.168.1.80::inst0::INSTR',vi1))
File "d:\RomeB0\pc_romeb0_cfgtool_lib_1020\VISA\visa.py", line 66, in VISA_Open
visa.viOpenDefaultRM(byref(defrm))
File "C:\Users\win\AppData\Local\Programs\Python\Python38-32\lib\ctypes\__init__.py", line 386, in __getattr__
func = self.__getitem__(name)
File "C:\Users\win\AppData\Local\Programs\Python\Python38-32\lib\ctypes\__init__.py", line 391, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'viOpenDefaultRM' not found
########################
32-bit Python in version 3.8 also does not work properly.Version 3.8 changes the way DLL is called.
Using version 3.6, 64 bit Python can work normally.
What are the solutions to the above two problems?
thanks
I didn't find the python section, so I sent it here.sorry.
my code:
from ctypes import *
visa = WinDLL("visa32.dll")
def VISA_Open(viaddress,vi_index):
defrm= c_uint32()
visa.viOpenDefaultRM(byref(defrm))
vi= c_uint32()
visa.viOpen(defrm, viaddress, 0, 0, byref(vi))
vi_index=vi.value
01-11-2022 09:14 PM
now python 3.6 32bit can run dll.but appear this error:
visa.viScanf(vi_index, b'%t', byref(strRes))
ValueError: Procedure probably called with too many arguments (12 bytes in excess)
CODE:
def VISA_Open(viaddress,vi_index):
defrm= c_uint32()
visa.viOpenDefaultRM(byref(defrm))
vi= c_uint32()
visa.viOpen(defrm, viaddress, 0, 0, byref(vi))
vi_index=vi.value
#print(vi_index)
VISA_Send(vi_index, '*IDN?')
VISA_Read(vi_index)
return vi_index
def VISA_Read(vi_index):
visa.viScanf(vi_index, b'%t', byref(strRes))
return strRes.value
why 64bit not this error?
by the way ,python 3.8 can't can yet!