Win32com Item method does not return object

Mark Hammond MarkH at ActiveState.com
Mon Jun 18 22:40:34 EDT 2001


Mark_Pryor wrote:

> Hi,
> 
> New to Python, using Version 2.1 on Win95.
> I have a COM object that has been registered into
> the gen_py folder. As I drill down through the object, I
> issue the Item method of a collection, which should return
> another collection, but fails returning a " tuple ".


PythonCOM returns a tuple when there are multiple return values from the 
function - typically byref params.

>>>>c = om.Tags.Item(1)


My guess is that for some reason, the Item method takes the int param byref.

But without seeing that C actually is, it is hard to speculate, but your 
best bet may be to write it as:

c, ignored = om.Tags.Item(1)

Mark.




More information about the Python-list mailing list