[python-win32] Access femap API, Type mismatch

Jim Ragsdale jimragsdale02 at gmail.com
Thu Dec 2 15:59:23 CET 2010

I am trying to access the femap API, and having a bit of trouble. Here
is a simple example:

from win32com.client import Dispatch
femap = Dispatch("femap.model")
rc = femap.feAppGetActiveView(viewID)

This method, according to the documentation, is supposed to return a
long integer in viewID. If I do not define viewID, python returns the

NameError: name 'viewID' is not defined

if I define viewID=0, python returns:

com_error: (-2147352571, 'Type mismatch.', None, 1)

I ran makepy and it generates a file, but I don't know if it is using
it or not. In the file, I can find the definition for the method:

def feAppGetActiveView(self, nViewID=pythoncom.Missing):
    return self._ApplyTypes_(20376, 1, (3, 0), ((16387, 2),),
u'feAppGetActiveView', None,nViewID

To me it looks like win32 is not getting the information about the
variable types from com. Is there any way to get around this or am I
out of luck?


More information about the python-win32 mailing list