[python-win32] Problem passing array by reference

Marco Nawijn nawijn at gmail.com
Fri Jul 18 19:28:25 CEST 2014


On Fri, 18 Jul 2014 09:26:34 -0700
Tim Roberts <timr at probo.com> wrote:

> Marco Nawijn wrote:
> > An update on where I am at the moment. I managed to find the
> > library that holds the definition for the GetComponents call. When
> > I run makepy on this library I get:
> >
> > def GetComponents(self, oAxisComponentsArray=defaultNamedNotOptArg):
> > return self._ApplyTypes_(1611005953, 1, (24, 0), ((8204, 3),),
> > u'GetComponents', None,oAxisComponentsArray)
> 
> For what it's worth, the (24,0) means the function returns "void", and
> (8204,3) means the parameter is an IN/OUT parameter that is an array
> of variants.
> 
> Given that, I'm a little confused as to why your original test --
> where you passed the list of 12 items -- didn't work.  As an
> experiment, you could try changing that to say (8204,11), which means
> "in/out and this is the return value", but I'm not hopeful.
> 
> We may need to get Mark Hammond involved in this.  He has more
> in-the-trenches experience here than anyone.
> 
> 
> 
> > Afterwards I tried to interact with it as follows:
> >
> > >>> from comtypes.client import CreateObject
> > >>> app = CreateObject('Catia.Application')
> > >>> app.Visible = True
> > >>> # I then interactively open a document in the application
> > >>> p1 = app.Documents.Item(2)
> > >>> p1
> > <POINTER(Document) ptr=0x577f24 at 4049490>
> >
> > So again, I get the "wrong" document type. If I do the same
> > but using late binding (by providing the "dynamic=True"
> > parameter) I get the following:
> > >>> p1
> > <comtypes.client.lazybind.Dispatch object at 0x028387B0>
> 
> Have you tried calling GetComponents with this object?  This is a
> late-bound object, which means it fetches the names of the methods and
> properties on the fly.
> 



More information about the python-win32 mailing list