Roman Yakovenko schrieb:
> Good morning.
>
> I got error while calling comtypes.client.GetModule function.
> Here is the call stack:
>
>>e:\Python25\pythonw.exe -u "pdb_reader.py"
> Traceback (most recent call last):
> File "pdb_reader.py", line 8, in <module>
> print comtypes.client.GetModule( r'D:\Program Files\Microsoft
> Visual Studio .NET 2003\Visual Studio SDKs\DIA SDK\bin\msdia71.dll' )
> File "e:\python25\Lib\site-packages\comtypes\client\_generate.py",
> line 100, in GetModule
> is_current, mod = _CreateWrapper(tlib, pathname)
> File "e:\python25\Lib\site-packages\comtypes\client\_generate.py",
> line 191, in _CreateWrapper
> return True, imp.load_module(modname, file_, module_path, desc)
> File
> "e:\Python25\lib\site-packages\comtypes\gen\_106173A0_0173_4E5C_84E7_E915422BE997_0_2_0.py",
> line 761, in <module>
> ( ['out'], POINTER(POINTER(IDiaSymbol)), 'ppSymbol' )),
> File "e:\python25\Lib\site-packages\comtypes\__init__.py", line 239,
> in __setattr__
> self._make_methods(value)
> File "e:\python25\Lib\site-packages\comtypes\__init__.py", line 492,
> in _make_methods
> prototype = WINFUNCTYPE(restype, *argtypes)
> File "e:\Python25\lib\ctypes\__init__.py", line 121, in WINFUNCTYPE
> class WinFunctionType(_CFuncPtr):
> TypeError: Error when calling the metaclass bases
> item 5 in _argtypes_ has no from_param method
>
> I am using standard Python 2.5 installation with ctypes module, which
> comes with it. I am using SVN version of comtypes.
The msdia71.dll typelibrary is buggy. The microsoft oleview utility, for
example,
decompiles an idl file which contains these snippets:
[
odl,
uuid(72827A48-D320-4EAF-8436-548ADE47D5E5),
helpstring("IDiaSymbol Interface")
]
interface IDiaSymbol : IUnknown {
...
HRESULT _stdcall get_dataBytes(
[in] unsigned long cbData,
[out] unsigned long* pcbData,
[out] IDiaSymbol data);
^^^^^^^^^^^^^^^^^^^^^^
...
HRESULT _stdcall get_types(
[in] unsigned long cTypes,
[out] unsigned long* pcTypes,
[out] IDiaSymbol types);
^^^^^^^^^^^^^^^^^^^^^^
...
HRESULT _stdcall get_typeIds(
[in] unsigned long cTypeIds,
[out] unsigned long* pcTypeIds,
[out] IDiaSymbol typeIds);
^^^^^^^^^^^^^^^^^^^^^^
...
};
There are also other interfaces in the typelib that have methods with invalid
parameters.
Note that IDiaSymbol is a COM interface; this cannot appear as parameter in a
COM
method (only pointers to interfaces are allowed). Of course, the MS idl
compiler
also refuses to compile such code.
What can you do? There are several options:
- fix the generated Python code manually: replace the parameter declarations
by valid ones
- try to compile a tlb yourself from the dia2.idl file that is also provided (I
tried this
but the compiler did not find a cvconst.h file that is imported by this idl).
Thomas
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
comtypes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/comtypes-users