Need Help with COM

Mark_Pryor erlangen72 at hotmail.com
Tue Aug 14 19:57:12 EDT 2001


Hi,
Michael A. Howard wrote in message <9lc9t0$fo4$1 at news.apple.com>...
>I'm coming to Python from VB and trying to understand how the COM stuff
>works.
>
>I have a COM server (not written by me) that supports in VB the call
>oAppPC.AppItem.Properties.Item(1).Caption
>Which returns the caption of this item as I can see it from the object
>browser in VB
>
>The same call in python returns:
>Traceback (most recent call last):
>  File "<interactive input>", line 1, in ?
>AttributeError: 'tuple' object has no attribute 'Caption'
>
>If I use Excel as an example i.e.
>o.Application.ActiveMenuBar.Menus.Item(1).Caption
>I get   u'&File'
>Which is also what I get in VB (well &File anyway)
>
>So what am I doing wrong?

Either write the call like this (to handle the tuple):
( junk, mycap ) = oAppPC.AppItem.Properties.Item(1).Caption

or redesign the Item method to pass the index by value!
You might have to switch the vars above.

hth,
Mark Pryor
pgp KeyID: 0x1A966EC5






More information about the Python-list mailing list