[python-win32] Problem to call COM-dynamic-server

Michel Claveau mc at mclaveau.com
Mon May 8 09:10:20 CEST 2006


Hello, all !


I have a problem, when I "dispatch" a dynamic server (writed with Pywin32).

When I call an instance method (with points in the name), the server 
receive, like wFlags, pythoncom.DISPATCH_PROPERTYGET, instead of 
pythoncom.DISPATCH_METHOD.

For the call of a property of a class, it's OK (good call, answer OK).

But, for a method, it's bad.  (the type of the called-object is  <type 
'instancemethod'>, and the Python call ask a property).


Here, a traceback :

pythoncom error: Python error invoking COM method.

exceptions.TypeError: Objects of type 'instancemethod' can not be converted 
to a
 COM VARIANT
Traceback (most recent call last):
  File "D:\dev\python\Ponxwscript.py", line 45, in ?
    vret=px.word___version()
  File "C:\Python24\lib\site-packages\win32com\client\dynamic.py", line 491, 
in
__getattr__
    raise pythoncom.com_error, details
pywintypes.com_error: (-2147352567, "Une exception s'est produite.", (0, 
'Python
 COM Server Internal Error', "Unexpected Python Error: exceptions.TypeError: 
Obj
ects of type 'instancemethod' can not be converted to a COM VARIANT", None, 
0, -
2147467259), None)




I had try to force the return of a value (in the server). Result :

Traceback (most recent call last):
  File "D:\dev\python\Ponxwscript.py", line 45, in ?
    vret=px.word___version()
TypeError: 'unicode' object is not callable



I had, also, try   dispatch, dispatchEx, .dynamic.Dispatch, etc.  Same 
result.



I hope that my English will have been comprehensible.


An idea?   Thanks by advance.


Michel Claveau






More information about the Python-win32 mailing list