win32com support

Crawley crawley.storm.dontsendmeemail at ntlworld.com
Sat Jan 31 12:21:37 CET 2004


Thanks for the reply, 

Now I think Ive figured out whats going on. Im getting the following 
error:

Traceback (most recent call last):
  File "E:\Python23\lib\site-packages\win32com\universal.py", line 170, 
in dispatch
    retVal = ob._InvokeEx_(meth.dispid, 0, meth.invkind, args, None, 
None)
  File "E:\Python23\lib\site-packages\win32com\server\policy.py", line 
322, in _InvokeEx_
    return self._invokeex_(dispid, lcid, wFlags, args, kwargs, 
serviceProvider)
  File "E:\Python23\lib\site-packages\win32com\server\policy.py", line 
601, in _invokeex_
    return DesignatedWrapPolicy._invokeex_( self, dispid, lcid, wFlags, 
args, kwArgs, serviceProvider)
  File "E:\Python23\lib\site-packages\win32com\server\policy.py", line 
541, in _invokeex_
    return func(*args)
  File "E:\code\Python\VCAddin.py", line 69, in OnConnection
    application.SetAddInInfo(None, self._command, -1, -1, addin )
  File "E:\Python23\lib\site-packages\win32com\client\dynamic.py", line 
460, in __getattr__
    raise AttributeError, "%s.%s" % (self._username_, attr)
exceptions.AttributeError: <unknown>.SetAddInInfo


Which I believe is because the object I'm calling does not support the 
SetAddInInfo method.


After a bit of investigation, this makes sense as my class extends 
_IDTExtensibility2 and for that the application parameter is of type 
'Object'.  I cant see how to cast this into an IApplication instance, 
which is what I need to call my function.

Ive also tried making my object derive from IDSAddin (what VC uses), but 
when I try the following (GUID found 
here:http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/vcug98/html/_asug_how_add.2d.ins_connect_and_disconnect.asp)

universal.RegisterInterfaces('{C0002F81-AE2E-11cf-AD07-00A0C9034965}', 0, 
1, 0, ["_IDSAddin"])

I get the following error:

Traceback (most recent call last):
  File "E:\code\Python\VCAddin.py", line 33, in ?
    universal.RegisterInterfaces('{C0002F81-AE2E-11cf-AD07-
00A0C9034965}', 0, 1, 0, ["_IDSAddin"])
  File "E:\Python23\lib\site-packages\win32com\universal.py", line 21, in 
RegisterInterfaces
    tlb = pythoncom.LoadRegTypeLib(typelibGUID, major, minor, lcid)
pywintypes.com_error: (-2147319779, 'Library not registered.', None, 
None)

Am I using the wrong name ('_IDSAddin') or the wrong GUID or is something 
more major going wrong.

Thanks for your help

Rich



More information about the Python-list mailing list