[python-win32] (Newbie) type mismatch

Schneider schnijders at home.nl
Wed Mar 24 08:13:23 EST 2004


Hi,

I am trying to code a call to a COM application (Sofon) which is a VC++
windows program as far as I know. Most calls just work fine, however on some
calls I get a type mismatch error.

The typelibrary states the following:

VARIANT_BOOL SetVersionDataElement(
BSTR FieldName,
VARIANT* Value);

In VB the call looks like this (works fine):

cProject.SetVersionDataElement sParName, sParVal

In Python I used:

sofon.project.SetVersionDataElement("OutputDocument", "PF")

Makepy produces this:

def SetVersionDataElement(self, FieldName=defaultNamedNotOptArg,
Value=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(6, LCID, 1, (11, 0), ((8, 0), (16396,
0)),FieldName, Value)

The traceback looks like:

Traceback (most recent call last):
  File "L:\InvoiceSofon\invoiceSofonMainFrame.py", line 459, in
OnFilemenuitems2Menu
    printRec(odbc, sofon, self.invoiceOverviewListCtrl, Index)
  File "L:\InvoiceSofon\invoiceSofonFunctopns.py", line 142, in printRec
    sofon.project.SetVersionDataElement("OutputDocument", "PF")
  File "<COMObject <unknown>>", line 2, in SetVersionDataElement
pywintypes.com_error: (-2147352571, 'Type komt niet overeen.', None, 2)

I am very desperate to get this to work since I would realy hate to learn
VB.
What goes wrong? Where to find more info on the COM stuff?

TIA

Frans




More information about the Python-win32 mailing list