[python-win32] Implementing a python com server that is used by a python client
Ulrich Mierendorff
ulrich.mierendorff at gmx.net
Mon Mar 1 23:10:42 CET 2010
Hi,
I have implemented a simple com server called "TestServer" using the
following mail as an example
http://markmail.org/message/vheujc2lijgwhhju#query:+page:1+mid:4lgd7lzzokglsckc+state:results
(but without multi-threading support)
Now I want to write a python client that should be able to connect to
"TestServer" via COM and receive events. Connecting to the server and
calling methods is easy: I just use win32com.client.Dispatch(..).
As far as I know I have to use DispatchWithEvents if I would like to
receive events. This requires makepy registration, so I created an
idl-file for the server, compiled it with midl to a tlb file and
compiled this with makepy to a python file.
Now I thought everything should work. But it doesn't:
Z:\extension\test>testclient.py
<COMObject testproject.TestServer>
Traceback (most recent call last):
File "Z:\extension\test\testclient.py", line 28, in <module>
server =
win32com.client.DispatchWithEvents("testproject.TestServer",
TestServerEventHandler)
File "C:\Python26\lib\site-packages\win32com\client\__init__.py", line
256, in DispatchWithEvents
raise TypeError("This COM object can not automate the makepy process
- please run makepy manually for this object")
TypeError: This COM object can not automate the makepy process - please
run makepy manually for this object
(I've attached a simple example client and server including the file
generated by makepy)
Others seem to have similar problems
http://www.mail-archive.com/python-win32@python.org/msg02142.html
http://mail.python.org/pipermail/python-win32/2008-November/008384.html
but I can't find a solution. Is it impossible? If yes, is there another
way to connect a python client to a python com server with events?
-Ulrich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.zip
Type: application/zip
Size: 3231 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100301/b6ae1922/attachment-0001.zip>
More information about the python-win32
mailing list