Connecting to running win32com server

ghubbar ghubbar at sandia.gov
Tue Oct 10 13:36:29 EDT 2000


I have an C++ application that needs to be able to query information
from a running python program.  Rather than using TCP/IP directly, I
decided it was time to learn win32com.  After some work I finally got
things to communicate, but it seems that the C++ program always starts
a new python process to handle the request, rather than using the
already running one.  This won't work for me, as the purpose is to
grab data being collected by the already running python script.

Is there some way around this, other than tricks like shared memory
between the running python process and the win32com server?  The
C++ code and the data collection program run on different computers.

If it matters, the C++ code looks something like
	CoGetClassObject(clsid,CLSCTX_LOCAL_SERVER,NULL,
		IID_IClassFactory,&pClassFactory)
	pClassFactory->CreateInstance(NULL,IID_Unknown,&pUnknown)
	pUnknown->QueryInterface(IID_IDispatch,&pObject)
	pObject->Invoke(...)
where CLSCTX_LOCAL_SERVER will change when I run this for real.
In addition, the win32com server is currently a wxPython script,
although it could be changed to a win32 GUI equivalent if that
would help.  My python test program has no GUI at all.  It is
essentially the SimpleComServer example from Chapter 5 of Python
Programming on Win32, with a __main__ that starts incrementing
a global variable which is returned by the one exported function.

TIA
Gary



More information about the Python-list mailing list