[python-win32] win32com.client.Dispatch problem

Thomas Heller theller at python.net
Fri Jun 24 21:01:51 CEST 2005


Amit Upadhyay <upadhyay at gmail.com> writes:

> Hi,
>
> So here is my problem, I have to implement a com server, that would be used 
> by DotNet application, which can not work with late binding (apparently they 
> don't have CreateObject of VB). So i am following the approach suggested by 
> http://starship.python.net/crew/theller/ctypes/sum_sample.html, and things 
> worked for a while but I am getting weird results now. Weird: python stops 
> working, just shows the prompt. 

No, I don't think it does stop working, although it seems so ;-)
It is difficult to test inproc (DLL) com servers implemented in Python
with Python as the exe client.  There is no isolation between the client
and the server - both use the same interpreter.

What you see is probably a flaw in the ctypes.com server implementation
- it redirects sys.stdout/sys.stderr to somewhere else (look into
ctypes\com\server.py).

You should either use different Python versions for the client and the
server, or use normal Python for one and a debug compiled Python for the
other, or - maybe that's the best and easiest - use an EXE COM server
for testing.  Since the exe server is a separate process, the isolation
is perfect.

Thomas



More information about the Python-win32 mailing list