COM object registration

Mark Hammond mhammond at
Thu Sep 19 04:08:30 CEST 2002

dsavitsk wrote:
> "Mark Hammond" <mhammond at> wrote in message
> news:4J_h9.19439$Ee4.59690 at
>>dsavitsk wrote:
>>>>>>a = win32com.client.Dispatch('ecp.MODULE_REGISTER2')
>>>Traceback (most recent call last):
>>>  File "<interactive input>", line 1, in ?
>>>  File "C:\Python\win32com\client\", line 92, in Dispatch
>>>    dispatch, userName =
>>>  File "C:\Python\win32com\client\", line 81, in
>>>    return (_GetGoodDispatch(IDispatch, clsctx), userName)
>>>  File "C:\Python\win32com\client\", line 72, in
> _GetGoodDispatch
>>>    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
>>>com_error: (-2147467259, 'Unspecified error', None, None)
>>It is likely that an exception is being encountered that we can get at
>>pretty easy.
>>Add a named param "debug=1" to all UseCommandLine calls.  Then, on both
>>machines, start Pythonwin and select the debug trace collector.  Rerun
>>your tests and see if any additional interesting exceptions are reported.
> This is the traceback, but I'm afraid it doesn't mean much to me.  It is the
> error that I got when using a VB client and where I get the 'localserver'
> notion.
> in _Invoke_ with 1000 0 2 ()
> in _Invoke_ with 1000 0 1 (u'MODULE_REGISTER2',)
> Registered: ecp.MODULE_REGISTER2 (for debugging)
> Object with win32trace dispatcher created (object=None)
> Traceback (most recent call last):
>   File "C:\Python\win32com\server\", line 27, in
> _CreateInstance_
>     self.policy._CreateInstance_(clsid, reqIID)
>   File "C:\Python\win32com\server\", line 199, in _CreateInstance_
>     myob = call_func(classSpec)
>   File "C:\Python\win32com\server\", line 634, in call_func
>     return apply(resolve_func(spec), args)
>   File "C:\Python\win32com\server\", line 624, in resolve_func
>     return getattr(module, fname)
> AttributeError: 'localserver' module has no attribute 'regmodule2'

The problem is that for some reason, the registration expects to have a class named 'regmodule2'.  I'm afraid I am not 
too sure exactly what is going on here and dont have time to setup a 
similar test environment - but after registration, you should be able to 
look in the registry for the objects you registered.  These will 
nominate the module and class names used by this class.  See what you 
can track down there.


More information about the Python-list mailing list