Connecting to running win32com

Alex Martelli aleaxit at yahoo.com
Tue Oct 17 18:21:40 EDT 2000


"ghubbar" <ghubbar at sandia.gov> wrote in message
news:39ECB9EF.D4EDEE5A at sandia.gov...
    [snip]
> My whole goal here is for a remote program, eventually on a second
> computer, to be able to access data collected by a long running
> data acquisition program.  Unfortunately, the instance started by
> running
> c:\progra~1\python\python serverCode.py
> is not the instance run by win32com.

Right, it isn't.  It's not registering the class factory with COM's
Service Control Manager when run normally -- you're not telling
it to do so.  That may be a bit tricky in Python (it would not be
in C++, but I'm not sure how to do it in Python) so the simplest
solution might be for the server to generate the COM object,
when started 'normally', and RegisterActiveObject it -- the
client would then have to GetActiveObject rather than create
a new instance, I think.  (The registration will have to be with
the 'strong' option, so the same active-object can be gotten
by several client requests).


> I can see a choice of creating a second, non-GUI program which the
> GUI program also communicates with using COM, placing any data
> there it might want to export.  The client on the second machine
> then communicates with this second, slave, program.  This would
> be acceptable, but seems a little kludgy.  Is there any way to
> do it within a single program?

You could have the GUI-part and the COM-server in the same
*program* but separate *processes*.  Would that seem less
kludgy to you?  It's probably simpler than either of the above
solutions (unless there's a simpler way to RegisterServerClass
from Python than comes to mind...).


Alex






More information about the Python-list mailing list