[python-win32] Re: problems in returning parameters using a COM client

Don Dwiggins d.l.dwiggins@computer.org
Sun, 22 Dec 2002 22:48:13 +0000 (UTC)


George Vestergom writes:
> however, trying out Jens idea:

>>>> xpos, ypos = cd.GetPosition(0, 0)

> results in this error message:

> Traceback (most recent call last):
>   File "<pyshell#7>", line 1, in ?
>     xpos,ypos=cd.GetPosition(0,0)
>   File "<COMObject CorelDraw.automation.6>", line 2, in
> GetPosition
> com_error: (-2147352571, 'Type mismatch.', None, 1)

> Both parameters in GetPosition are 'out'. I've even tried the following,
> giving the same above error message:
>>>> x = 0
>>>> y = 0
>>>> xpos, ypos = cd.GetPosition(x, y)     # error

If both params are 'out', try it like this: "xpos, ypos = cd.GetPosition()";
if my understanding is correct, you only want to include 'in' or 'in/out'
params in the argument list.  That may be what the 'Type mismatch.' was
trying to tell you.

Mark's advice about getting the type library info compiled in with makepy,
Ensure..., etc. are also useful.  If you do that, then try things like the
above in Pythonwin, you'll get popup information about the available methods
of objects and their expected input params.  Where the type library info is
available, it's by far the best way to fly.

Good hunting and happy holidays,
-- 

Don Dwiggins			 "Experience is what you get when
d.l.dwiggins@computer.org         you were expecting something else."
                                  -- Seen on an office wall