I was wondering if anybody could help me make sense of this error. I am calling a LabVIEW generated dll in python that communicates to a DCM via a CAN protocol.
The structure and input parameters of the LabVIEW function called in Python is as follows:
int32_t func_1(CStr version_number, int32_t Verbose, CStr SetupFileName);
I know that the dll is imported into Python, and that the parameters are being input correctly because other functions with the same structure have the same input parameters and they don't return an error.
import ctypes as c
mydll = c.windll.LoadLibrary('intcan.dll') #'C:/Users/PycharmProjects/impdll/intcan.dll')
mydll.func_1(c.c_char_p('15.1.1.1'), c.c_int(0), c.c_char_p('CanDevice.xml'))
When I run the code I get the following error.
Traceback (most recent call last):
File "C:/Users/PycharmProjects/impdll/venv/tester.py", line 22, in <module>
mydll.func_1(c.c_wchar_p('15.1.1.1'), c.c_int(0), c.c_wchar_p('CanDevice.xml'))
OSError: [WinError -529697949] Windows Error 0xe06d7363
Process finished with exit code 1
There are a number of ways in which you can configure a string to be passed into a function in a LabVIEW DLL.
If the string is just an input, the easiest way is to set:
which would yield this function prototype:
void func_1(char MyString[])
you can then call in Python as:
import ctypes as c
mydll = c.windll.LoadLibrary('mydll.dll')
mydll.func_1("myValue".encode("ascii"))
User contributions licensed under CC BY-SA 3.0