COM component implementing custom interfaces

Mark Hammond mhammond at skippinet.com.au
Thu Jul 4 20:34:37 EDT 2002


Daniel Piñol Laserna wrote:
> Mark Hammond <mhammond at skippinet.com.au> wrote in message news:<3D2387EF.6020306 at skippinet.com.au>...
> 
>>You need to check out the win32com\servers\test_pycomtest.py - this 
>>shows how to implement non IDispatch based interfaces.
>>
>>Mark.
> 
> 
> When I run the example, I get 
> Traceback (most recent call last):
>   File "d:\dani\AppDev\python\APython22\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
> line 301, in RunScript
>     exec codeObject in __main__.__dict__
>   File "d:\dani\AppDev\python\APython22\Lib\site-packages\win32com\servers\test_pycomtest.py",
> line 13, in ?
>     universal.RegisterInterfaces('{6BCDCB60-5605-11D0-AE5F-CADD4C000000}',
> 0, 1, 1, ["IPyCOMTest"])
>   File "d:\dani\AppDev\python\APython22\Lib\site-packages\win32com\universal.py",
> line 29, in RegisterInterfaces
>     tlb = pythoncom.LoadRegTypeLib(typelibGUID, major, minor, lcid)
> com_error: (-2147319779, 'Library not registered.', None, None)
>  
> If I comments out the offending line
> (universal.RegisterInterfaces...), it runs ok and the object appears
> in OLE COM viewer. But if I try to instantiate from VB, I get this
> error
>  
>     Unexpected Python Error: pywintypes.com_error: (-2147319779,
> 'Library not registered.', None, None)
>     -2147467259 
>  
> I couldn't find any TLB or IDL to register

That is a sample, and requires the PythonCOM test harness to completely 
work.  So while you can probably not directly run the sample, you should 
be able to get enough out of it to make yours work.

If someone would like to contribute a sample for a well-known COM object 
I can distribute I would be very appreciative.

Mark.




More information about the Python-list mailing list