python - comtypes com object's method returns: 'tuple' object has no attribute '__ctypes_from_outparam__' -
i'm invoking method of com object string argument using comtypes
, method returns (it should return com string):
--------------------------------------------------------------------------- attributeerror traceback (most recent call last) <ipython-input-102-009507ff0086> in <module>() ----> 1 obj1=xobjdata.getdatatype('string_name') c:\python\python27\lib\site-packages\comtypes\__init__.pyc in call_with_inout(self_, *args, **kw) 657 # iterable. 658 if len(outargs) == 1: # rescode not iterable --> 659 return rescode.__ctypes_from_outparam__() 660 661 rescode = list(rescode) attributeerror: 'tuple' object has no attribute '__ctypes_from_outparam__'
seems cryptic error, help?
%debug
magic shows following:
> c:\python\python27\lib\site-packages\comtypes\__init__.py(659)call_with_inout() 658 if len(outargs) == 1: # rescode not iterable --> 659 return rescode.__ctypes_from_outparam__() 660 ipdb> outargs {0: variant(vt=0x8, u'string_name')} ipdb> rescode (variant(vt=0x8, u'string_name'), u'long') ipdb> print(dir(outargs)) ['__class__', '__cmp__', '__contains__', '__delattr__', '__delitem__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'has_key', 'items', 'iteritems', 'iterkeys', 'itervalues', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values', 'viewitems', 'viewkeys', 'viewvalues'] ipdb> print(dir(rescode)) ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index'] ipdb> u > <ipython-input-112-83ed14b8961f>(1)<module>() ----> 1 xobjdata.getdatatype(u'string_name') ipdb> d > c:\python\python27\lib\site-packages\comtypes\__init__.py(659)call_with_inout() 658 if len(outargs) == 1: # rescode not iterable --> 659 return rescode.__ctypes_from_outparam__() 660 ipdb> exit
this bug in comtypes, see fix here:
Comments
Post a Comment