I have defined an MS COM interface which I want to access from within Python. I
therefore have created a wrapper using the 'makepy' utility that come along
with the win32com package.
[
object,
dual,
...
]
interface IPuma7ScriptContextEx : IDispatch
{
:
[id(21), helpstring("method GetScriptObject")]
HRESULT GetScriptObject([in] long ContextId, [in] BSTR ModuleName, [out,
retval] IPuma7Script ** ppPuma7Script);
[id(22), helpstring("method GetScriptDispatch")]
HRESULT GetScriptDispatch([in] long ContextId, [in] BSTR ModuleName, [out,
retval] IDispatch ** ppPuma7ScriptDispatch);
:
};
As it now turns out, the generated Python wrapper seems not to work for all
member functions of the interface. It does work for function 'GetScriptObject':
>>>ScriptContextEx.GetScriptObject(0,"User")
< win32com.gen_py.AVL PUMA7 Object Model 1.0 Type Library.IPuma7Script instance
at 0x59539888>
But it does not work for 'GetScriptDispatch':
>>>ScriptContextEx.GetScriptDispatch(0,"User")
Traceback (most recent call last):
File "", line 1, in
File
"C:\Python37-32\lib\site-packages\win32com\gen_py\27E37C67-3AE4-11D5-A53E-0004AC2566F4x0x1x0\IPuma7ScriptContextEx.py",
line 42, in GetScriptDispatch
, ModuleName)
pywintypes.com_error: (-2147352573, 'Member not found.', None, None)
The only apparent difference between these two functions is that the first one
(that works) returns an IPuma7Script interface pointer which is also declared
in the respective TLB file whereas the second one returns a 'standard'
IDispatch interface pointer.
Is there a solution some around already or at least a workaround? Any help is
highly welcome.
Thanks and best regards
Ludwig
____________________________________________________________________________
AVL List GmbH, Firmensitz: Graz, Firmenbuchnummer: FN 53507M, Landesgericht
fuer ZRS Graz
_______________________________________________
python-win32 mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-win32