I want to call a function inside a DLL from Python. But I get this error:
"Attribute Error function not found"
This is my code:
import os import ctypes os.chdir("C:\\Program Files\\Compact Automated Testing System V2.0") # Load DLL into memory. CATSDll = ctypes.WinDLL ("CATS.dll") # Set up prototype and parameters for the desired function call. CATSDllApiProto = ctypes.WINFUNCTYPE (ctypes.c_uint8,ctypes.c_double) CATSDllApiParams = (1, "p1", 0), (1, "p2", 0), # Actually map the call (setDACValue) to a Python name. CATSDllApi = CATSDllApiProto (("setDACValue", CATSDll), CATSDllApiParams) # Set up the variables and call the Python name with them. p1 = ctypes.c_uint8 (1) p2 = ctypes.c_double (4) CATSDllApi(p1,p2)
But the DLL documentation shows the setDACValue function with ChannelId and DAC Voltage as inputs.
The above information is based on a piece of code available in StackOverflow.
I also tried a simple method to use cdll.LoadLibrary and then called a function, but this also gives the same error.
Can someone tell me what is wrong? Thanks.
Full trace:
Traceback (most recent call last): File "C:\Users\AEC_FULL\Softwares\eclipse\plugins\org.python.pydev_3.9.2.201502050007\pysrc\pydevd.py", line 2235, in <module> globals = debugger.run(setup['file'], None, None) File "C:\Users\AEC_FULL\Softwares\eclipse\plugins\org.python.pydev_3.9.2.201502050007\pysrc\pydevd.py", line 1661, in run pydev_imports.execfile(file, globals, locals)

source share