Using Python with COM to communicate with proprietary Windows software

Joakim Persson zaladin at
Fri Sep 9 18:15:44 CEST 2005

On Fri, 09 Sep 2005 08:36:00 +0200, Thomas Heller <theller at>

>Joakim Persson <zaladin at> writes:
>> I have a rather bloated C++ client prototype which "works", so I
>> should have all the code needed to invoke the interface, but this
>> client is of course rather bloated in itself and not suitable for my
>> experimental programming approach. Am I right in believing that the
>> COM interface I am trying to use is of what is called a "custom" type,
>> that I cannot access using Python + win32com?
>Sounds like a perfect job for comtypes, which is a COM library
>implemented in pure Python, based on ctypes.  comtypes should make it
>easy to access custom (non-dispatch derived) com interfaces, or the
>vtable based part of dual interfaces - it would be good however, if you
>have a type library for the interfaces.
>No docs yet, but there are tests included which should get you started.
>(I have released and announced this 3 weeks ago, but haven't got a
>single feedback.  So it seems the need to access custom interfaces is
>very low.)

Looks good, I think I downloaded ctypes but didn't put in the effort
to wrap the custom COM interface.

I have the type library and full documentation of the interface, so
IMO it _should_ be possible to make a 100% Python application for
testing this particular interface, which would definitely speed up
prototyping, which is the entire goal of my work. I will give it a
spin tomorrow, and I'll get back on the NG once I have tested it. Many

It seems most Python uses for COM rely on "simple" automation of COM
interfaces of the IDispatch type, but I need something more (full
client<->server communication and threading, for instance). Hopefully
your module will at least let me get one step further... 

My remaining two options, seeing as I would really like to at least
put the data processing and presentation part in Python, are linking
Python with C++ for the COM part and building (Data + Presentation) in
Python, or making a complete standalone C++ part for the COM part and
then _another_ client<->server solution using e.g. named

Joakim Persson
M.Sc student, CS/E @ LTH

More information about the Python-list mailing list