Hi,

I’m trying to control an existing COM server (C++ code) with a python COM
client.

Unfortunately, no type library exists for most of the COM objects. Thus I’m
restricted to the dynamic dispatch implementation.



This is my sample code. Its equivalent works flawlessly when called via
VBA, moreover I'm sure that the requested COM methods exist in the server.



import win32com.client

obj_1 = win32com.client.DispatchEx(“MyCOMServerApplication”)

obj_2 = obj_1.NewDocument() # works, returns a new dynamic dispatch
(<CDispatch: None>)

obj_2.SubObject.DoSomething(“MyArgument”) # works, but only if I don’t step
into it (i.e. into CDispatch.__getattr__)

#obj_2.GetSomeNumber()  # TypeError: 'int' object is not callable

obj_2.GetSomeNumber  # works correctly, but only if I don’t step into it
(i.e. into CDispatch.__getattr__)

obj_2.DoSomething(“MyArgument”) # doesn’t work



I also tried passing any arguments (e.g. “MyArgument”) as VARIANTs, but to
no avail.


Evidently I’m very confused, especially since the behavior differs when
stepping into the relevant python code.

I have also read that the dynamic dispatch implementation doesn't support
by-ref parameters, is this information still up to date?

Looking forward to any help. If needed, I'll gladly provide more
information.


Thanks,

Dominik
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to