How to debug ctypes call of c++ dll?
Question: in my python project I call a c++ dll using ctypes library. That c++ dll
consists on a wrapper dll that calls methods of a c# com interop dll.

Sometimes I have a COM exception. I like to see what it corresponds exactlly
but I don't know how to do it?

How can I attach the c++ debugger to this situation?

Thanks in advance


Answer: I don't know about your direct question, but maybe you could get around it by
using [comtypes](http://sourceforge.net/projects/comtypes/) to go straight
from COM to Python instead sticking C++ in between.

Then all you have to do is:

    
    
    >>> from comtypes import client, COMError
    >>> myclassinst = client.CreateObject('MyCOMClass.MyCOMClass')
    >>> try:
    ...     myclassinst.DoInvalidOperation()
    ... except COMError as e:
    ...     print e.args
    ...     print e.hresult
    ...     print e.text
    ...
    (-2147205118, None, (u'MyCOMClass: An Error Message', u'MyCOMClass.MyCOMClass.1', None, 0, None))
    -2147205118
    None
    

