[python-win32] win32com and COM-dynamic-server
Mark Hammond
mhammond at skippinet.com.au
Thu Nov 3 23:19:55 CET 2005
When Python code does:
obj.foo(1)
On a COM object that has no makepy support, Python will first query the
object if it has a *property* named 'foo' before it asks if it has a
*method* named foo. I suspect you are seeing this. To work correctly in
this case, Python will be expecting the property reference to fail (so it
can determine it is indeed a method)
> of functions are in small letters, but no other parameter is transmitted.
> To check, I supervised the line:
> def _dynamic_(self, name, lcid, wFlags, args):
The wFlags param of that call indicates if it is a property or method
reference. If it does turn out to be a property reference, there will be no
args passed.
>
> I tested Dispatch, DispatchEx, dynamic.Dispatch, without more success.
>
> It should be noted that, if I remove the line:
> _ reg_policy_spec _ = "DynamicPolicy"
> The problem disappears.
>
>
> My question: how to use (call functions with parameters) a (my)
> dynamic-COM-server-Python, since Python?
>
> Last infos : Python 2.4.2 ; PyWin32 205 ; Win-XP-SP2 ; Bedside's book:
> "Programming Python on win32".
Have a look at page 220 - it has an example of _dynamic_ checking wFlags.
Cheers,
Mark
More information about the Python-win32
mailing list