Problem passing COM object

wmistar at cyclones.com wmistar at cyclones.com
Mon Dec 25 01:08:04 EST 2000


Hi,

I'm trying to call the following COM interface: (generated by MakePy)

	def AutoLogIn(self, UserName=defaultNamedNotOptArg,
Password=defaultNamedNotOptArg, databaseDir=defaultNamedNotOptArg,
ServerName=defaultNamedNotOptArg, forceLogin=defaultNamedNotOptArg,
appObject=defaultNamedNotOptArg):
		return self._oleobj_.InvokeTypes(0x2, LCID, 1, (3, 0),
((8, 0), (8, 0), (8, 0), (8, 0), (11, 0), (16393, 0)),UserName,
Password, databaseDir, ServerName, forceLogin, appObject)

Notice the 7th parameter 'appObject'.  When I pass an object that
was instantiated with:
tr = win32com.client.Dispatch('TRDatabase.Application')

The error comes out as follows:
>>> dbh = trdb.AutoLogin("", "", "", "", 0, tr)
Traceback (innermost last):
  File "<interactive input>", line 1, in ?
  File "<COMObject TRDatabase.Database>", line 2, in AutoLogin
com_error: (-2147352571, 'Type mismatch.', None, 6)

The tr is confirmed to be a COM object by doing this:
>>> tr
<COMObject TRDatabase.Application>

So why the Type mismatch error? Do I have to do something special
to pass around Application COM objects?

In VB, the same call is sucessfully done by doing this:
Dim mtr As TRDatabase.Application

dbh = trdb.AutoLogin("", "", "", "", bForceLogin, mtr)

Please help,
-Will--


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list