ValueError: argument is not a COM object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stefano Masini

    ValueError: argument is not a COM object

    Hi,

    I'm scripting Adobe InDesign CS with python, through COM interface.

    This is how I get the application object:

    win32com.client .Dispatch('InDe sign.Applicatio n')

    I'm not a guru of com programming, but I've gone quite far in my
    purpose so far.
    Now I'm stuck.

    There's a method Add in object Groups (which is in object Page, etc.)
    that's supposed to take a parameter called GroupItems of type "Array
    of Objects", according to the Visual Basic programming reference.

    I have the following piece of code:

    print 'obj1: %r, obj2: %r' % (comObjs[0], comObjs[1])
    grps = self.page.comPa ge.Groups
    grps.Add( GroupItems=(com Objs[0], comObjs[1]) )

    Which gives me:

    obj1: <COMObject <unknown>>, obj2: <COMObject <unknown>>

    [...]
    File "modPrint.p y", line 204, in creaFrameLoghi
    grps.Add( GroupItems=(com Objs[0], comObjs[1]) )
    File "<COMObject <unknown>>", line 2, in Add
    ValueError: argument is not a COM object


    Why is it so?
    I suppose the type system is having troubles figuring out the type of
    the list elements.
    So, what do I do?

    I hope somebody can help,
    thank you!
    stefano
Working...