[python-win32] (Newbie) type mismatch
John Purser
johnp at HomeLumber.com
Wed Mar 24 09:16:07 EST 2004
I'm just starting to dig into Python and Com and like you I'm looking for better reference material than I've found. Is there a book that covers Com better than "Python Programming on Win32 Help for Windows Programmers By Mark Hammond & Andy Robinson" which is 4 years old now?
I can offer this link which is to chapter 12 of their book on the O'Reilly site:
http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html
And you might consider that the com call expects Unicode strings, not ASCII if I've read this all correctly.
Good luck and if you find a good reference please post it back to the group.
Thanks,
John Purser
-----Original Message-----
From: Schneider [mailto:schnijders at home.nl]
Sent: Wednesday, March 24, 2004 6:13 AM
To: python-win32 at python.org
Subject: [python-win32] (Newbie) type mismatch
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
_______________________________________________
Python-win32 mailing list
Python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32
More information about the Python-win32
mailing list