win32com and "collection"

Mark Hammond mhammond at skippinet.com.au
Thu May 29 18:25:31 EDT 2003


Jess Austin wrote:
> When I had originally looked at win32com.server.util, I had noticed that
> NewCollection() basically just returns a wrapped Collection.  It makes sense
> that we wouldn't be able to wrap something twice.  So unless I'm missing
> something, we can expect either util.NewCollection([]) or
> util.wrap(util.Collection([])) to give us something we can pass to COM.

Yes - my mistake.

> Reference my first message for the error that was produced when I attempted
> to do that.  Does that point to a bug in pythoncom.WrapObject() or maybe
> PyIDispatch.InvokeTypes()?

Unfortunately, I am fairly confident that win32com will be passing an 
IDispatch pointer to the COM object.  I have no idea if the object is 
being QI'd for an interface we don't support (there appears to be no 
standard IID for a "collection").  You could possibly confirm this by 
doing a wrap with a "tracer" for the collection - ie, pass 
useDispatcher=win32com.server.dispatcher.DefaultDebugDispatcher (or 
something like that), and you should see QI etc calls on that object.

Mark.





More information about the Python-list mailing list