COM object registration

Mark Hammond mhammond at skippinet.com.au
Wed Sep 18 22:08:30 EDT 2002


dsavitsk wrote:
> "Mark Hammond" <mhammond at skippinet.com.au> wrote in message
> news:4J_h9.19439$Ee4.59690 at news-server.bigpond.net.au...
> 
>>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\__init__.py", line 92, in Dispatch
>>>    dispatch, userName =
>>>dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
>>>  File "C:\Python\win32com\client\dynamic.py", line 81, in
>>>_GetGoodDispatchAndUserName
>>>    return (_GetGoodDispatch(IDispatch, clsctx), userName)
>>>  File "C:\Python\win32com\client\dynamic.py", line 72, in
>>
> _GetGoodDispatch
> 
>>>    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
>>>pythoncom.IID_IDispatch)
>>>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.
>>
>>Mark.
>>
> 
> 
> 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\dispatcher.py", line 27, in
> _CreateInstance_
>     self.policy._CreateInstance_(clsid, reqIID)
>   File "C:\Python\win32com\server\policy.py", line 199, in _CreateInstance_
>     myob = call_func(classSpec)
>   File "C:\Python\win32com\server\policy.py", line 634, in call_func
>     return apply(resolve_func(spec), args)
>   File "C:\Python\win32com\server\policy.py", 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 
localserver.py 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.

Mark.




More information about the Python-list mailing list