Accessing Return Values with COM using Python

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 print is 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 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

Need Your Help

Problem in IE6 with fixed position and multi-select boxes when scrolling

iframe internet-explorer-6 css scroll multi-select

I am using the common css-workaround to achieve a fixed position of an element in IE6

Does it make sense to use const in an interface or not?

c++ design interface const

I have a module that performs some calculations and during the calculations, communicates with other modules. Since the calculation module does not want to rely on the other modules, it exposes an

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.