COM servers in python

Bob Calco rcalco at cortechs.com
Wed Jan 3 16:30:49 EST 2001


For the Win32/COM folk:

I would like to encapsulate numerous command line utilities that are part of
my program and provide COM wrappers to them in Python, mainly for
prototyping purposes; eventually, they'll be implemented in C++ Builder or
Delphi (depending on who works on it).

The question I have is regarding aggregation/containment strategies. Does
anyone have any experience trying to aggregate or contain several COM
objects (both written in Python and not) through a single COM server written
in Python? I don't expect it to perform super fast or anything, but one of
the goals of the prototypes is to provide sufficient backend functionality
so that pieces of the front end can be developed further while the design of
the back end interfaces is solidified (hopefully, with the experience of
using the Python COM wrappers). Writing these critters from scratch in C++
is rather a hassle. I want to use Python to prototype them, then, once I'm
happy with the methods and properties, go right to IDL and implement them in
C++. Ideally, we'll prototype them in Python, test them and say, "Hey, they
work great! Let's go code them in..XXX" but realistically I expect to refine
them before we go code them.

I have Mark Hammond's and Andy Robinson's book, "Program Python on Win32"
and it certainly whetts the appetite but still I'd like to understand things
a little better. For instance, how to implement Connection Points -- some of
my utilities will have output or may occasionally require input from the
user. I'd like the clients to be able to take that output as it comes and do
with it what they may, or react to requests for input, but that implies
being able to fire an event from the server that is handled by the client.
Can this be done in Python? Mark seems to discourage the use of callbacks,
for instance, but this is a very common thing for a COM object to do, and
one of the things that makes ActiveX controls possible. Or should I just
wait till I implement such features in C++/Delphi?

I have peeked with curiosity at the ccompiler.py and msvccompiler.py and
observed that several of my command line utilities wrappers will be as
complex as msvccompiler.py in terms of the numbers of options and the logic
to keep the command line "clean" and non-contradictory. However, the
workflow of a given instance of my program needs to juggle instances of my
command line utilities deftly in order for the end user to enjoy his/her
experience. So there's a lot going on.

Any thoughts, questions or suggestions are welcome.

#*******************************************
#* Bob Calco
#* Lead Developer
#* CorTechs, Inc.
#*******************************************
#* MI Certified Product Specialist
#* MI Certified Product Instructor
#*******************************************
#* rcalco at cortechs.com
#* 703.989.3160 -- cell
#* 703.968.7021 -- office (ext. 120)
#* 703.968.8180 -- fax
#*******************************************





More information about the Python-list mailing list