[python-win32] Access coclass interface?
Thomas Heller
theller at ctypes.org
Fri Jan 10 19:51:57 CET 2014
Am 10.01.2014 15:26, schrieb Khoroshyy Petro:
> Hi list,
> I try to control a setup which consist of a monochromator and a CCD camera.
[...]
>
> Now if I try to access a monochromator coclass from another libray in
> the same way I get com_error: (-2147221005.
> instrument = win32com.client.Dispatch("JYMONOLib.IJYMonoReqd")
> or
> instrument = win32com.client.Dispatch("JYMONOLib.Monochromator")
You can use ctypes.WinError to look up the error code if it known
to windows:
>>> from ctypes import *
>>> raise WinError(-2147221005)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
WindowsError: [Error -2147221005] Ungültige Klassenzeichenfolge
>>>
In english this would read: 'Invalid class string'.
This means that the COM runtime does not know about the
"JYMONOLib.IJYMonoReqd" and "JYMONOLib.Monochromator" names.
Thomas
More information about the python-win32
mailing list