[python-win32] Makepy does not generate all secondary interfaces?
Åsmund Hjulstad
asmund.hjulstad at gmail.com
Wed Nov 10 01:57:50 CET 2010
2010/11/9 Tim Roberts <timr at probo.com>:
> Åsmund Hjulstad wrote:
>>>> My latest attempt is
>>>>
>>>> pisdkcommonlib = ('{76A44786-EBC8-11D3-BDC5-00C04F779EB2}', 0, 1, 0)
>>>> win32com.client.makepy.GenerateChildFromTypeLibSpec("IPIAsynchStatus2",
>>>> pisdkcommonlib, 1)
>
> That's not the correct usage. Did you see an example of this somewhere?
No, I made a guess from looking at the source code.
> What happens if you do xxx.QueryInterface and specify the GUID of the
> interface you want?
a = EnsureDispatch('PISDKCommon.PIAsynchStatus')
a._oleobj_.QueryInterface('{ECA80073-B652-478A-B191-E87A924EB723}')
gives this error:
TypeError: There is no interface object registered that supports this IID
and if I try
a = Dispatch('PISDKCommon.PIAsynchStatus', None,
'{ECA80073-B652-478A-B191-E87A924EB723})
I get
ImportError: No module named IPIAsynchStatus2
Stack trace as follows: (I'm running this from IPython)
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\IPython\iplib.py", line 2257, in runcode
exec code_obj in self.user_global_ns, self.user_ns
File "<ipython console>", line 1, in <module>
File "C:\Python27\lib\site-packages\win32com\client\__init__.py",
line 96, in Dispatch
return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo,
clsctx=clsctx)
File "C:\Python27\lib\site-packages\win32com\client\__init__.py",
line 37, in __WrapDispatch
klass = gencache.GetClassForCLSID(resultCLSID)
File "C:\Python27\lib\site-packages\win32com\client\gencache.py",
line 179, in GetClassForCLSID
mod = GetModuleForCLSID(clsid)
File "C:\Python27\lib\site-packages\win32com\client\gencache.py",
line 240, in GetModuleForCLSID
makepy.GenerateChildFromTypeLibSpec(sub_mod, info)
File "C:\Python27\lib\site-packages\win32com\client\makepy.py", line
320, in GenerateChildFromTypeLibSpec
__import__("win32com.gen_py." + dir_name + "." + child)
File "C:\Python27\lib\site-packages\winpdb-1.4.8-py2.7.egg\rpdb2.py",
line 13487, in rpdb2_import_wrapper
m = g_import(*args, **kwargs)
ImportError: No module named IPIAsynchStatus2
Using pdb, I find that the first two arguments for the
GenerateChildFromTypeLibSpec function call are
child = IPIAsynchStatus2
typelibInfo = ('{76A44786-EBC8-11D3-BDC5-00C04F779EB2}', 0, 1, 0)
(which is the same function call as I tried myself, previously)
More information about the python-win32
mailing list