Hello! I'm quite new to the pywin32 package (as in I have never interacted with it before). I'm currently trying to implement a python interface to a win32 bit program that I can connect to using the ordinary win32com.client.Dispatch method. This program controls an microscope camera and the only way to connect to it is via this COM connection. There is already an version of this software written in pascal by the manufacturers so I'm trying to create an expanded python version of this software.
I've managed to get the connection working and I can send commands that do not require any inputs and access the attributes of the interface/program. The problem is that when I try to send commands to one of two exposed methods that require input I get the follow error: s = win32com.client.VARIANT(pythoncom.VT_LPWSTR, 'On\0') r = win32com.client.VARIANT(pythoncom.VT_LPWSTR, 'AL\0') Response = AIPam.scriptCmd(r,s) Traceback (most recent call last): File "<ipython-input-38-c5635b52a462>", line 1, in <module> Response = AIPam.scriptCmd(r,s) File "C:\Users\GWHLAB~2\AppData\Local\Temp\gen_py\3.8\E07C24C7-56CE-409F-AB60-DC7EDE9D9888x0x1x0.py", line 37, in scriptCmd return self._oleobj_.InvokeTypes(216, LCID, 1, (3, 0), ((31, 1), (31, 1)),cmd TypeError: The VARIANT type is unknown (0x0000001f) I've tried with s and r set to various combinations of either just a regular python string, VARIANT with VT_LPWSTR with either (\0 or 0) terminator or without terminator. They all give the same error. (As I understood that 31 VT code meant a VT_LPWSTR) The corresponding command in pascal looks like: IPam.scriptCmd('AL','On') and it works. Anyone who knows what might the issue/how to fix it? Kind Regards, Olle
_______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32