[python-win32] comtypes cryptic error - no attribute '__ctypes_from_outparam__'

AKHIYAROV, Denis (WGK) Denis.Akhiyarov at woodgroupkenny.com
Wed Sep 30 17:07:53 CEST 2015


Hello pywin32 users and developers,

I’m generally pretty happy about using COM through comtypes, but get this cryptic error below.

https://github.com/enthought/comtypes/issues/87
http://stackoverflow.com/questions/32869070/comtypes-com-objects-method-returns-tuple-object-has-no-attribute-ctypes

I'm invoking a method of COM object with string argument using comtypes and method returns (it should return a 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             # be iterable.
    658             if len(outargs) == 1:  # rescode is not iterable
--> 659                 return rescode.__ctypes_from_outparam__()
    660
    661             rescode = list(rescode)

AttributeError: 'tuple' object has no attribute '__ctypes_from_outparam__'

Seems very cryptic error, any help?
%debug magic shows following:

> c:\python\python27\lib\site-packages\comtypes\__init__.py(659)call_with_inout()
    658             if len(outargs) == 1:  # rescode is 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> exit



Denis Tauzikhovich Akhiyarov, Senior Consultant
15115 Park Row - Suite 250
Houston, Texas 77084
+1. 281.600.3685 (Direct)
+1. 918.200.3994 (Mobile)
+1. 281.646.1515 (Switchboard)

Denis.Akhiyarov at woodgroupkenny.com<mailto:Denis.Akhiyarov at woodgroupkenny.com>
www.msikenny.com<http://www.msikenny.com/>
www.woodgroupkenny.com<http://www.woodgroupkenny.com/>
[cid:image002.png at 01CF28A3.5A0DAE20]


Please consider the environment before printing this email.

This email and its attachments may contain information which is confidential and/or legally privileged. If you are not the intended recipient of this e-mail please notify the sender immediately by e-mail and delete this e-mail and its attachments from your computer and IT systems. You must not copy, re-transmit, use or disclose (other than to the sender) the existence or contents of this e-mail or its attachments or permit anyone else to do so.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20150930/df998f4c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 38486 bytes
Desc: image001.png
URL: <http://mail.python.org/pipermail/python-win32/attachments/20150930/df998f4c/attachment-0001.png>


More information about the python-win32 mailing list