I am using Python with win32com to access COM objects. One of the COM objects is supposed to return another COM object but a tuple about the called method is returned instead. Is there a way to access the returned data?
The statement which I programmed is:
item = server.OPCHDAItems.AddItem(“TIC101”,1)
item should be the object added, an OPCHDAItem. When I print item I just get
<COMObject AddItem>
The item was added to the OPCHDAItems collection because I can see the size of the collection increasing.
From reading the docs about win32com is states taht a tuple is returned from a method call but I could not find how to access the return data from the method call.
I may be wrong but I think the OPCHDAItem has been added properly. The
printis using the__repr__or the__str__method of the class for printing something. A COM class is automatically generated, so I guess these methods are not overloaded.Try to generate the interface of the COM object with the MakePy utility (see http://oreilly.com/catalog/pythonwin32/chapter/ch12.html). It will create a file that contains the description of the COM object. In this file, you should see the list of attributes and methods of the objects.
I hope it helps