[python-win32] Desire information about Invoke and InvokeTypes

Mark Hammond mhammond at skippinet.com.au
Tue Apr 20 01:49:20 EDT 2004


> Python program fragment:
>
> sc = chart.SeriesCollection()
> sc.Add(series_range, seriesAddDirection)
>
> The last line causes an error.

What error exactly?

> Here's the method code
> generated for Add by
> the dispatch module:
>
> def Add(self, Source=pythoncom.Missing, Rowcol=2,
> SeriesLabels=pythoncom.Missing, CategoryLabels=pythoncom.Missing,
> Replace=pythoncom.Missing):
>          ret = self._oleobj_.InvokeTypes(181, LCID, 1, (9,
> 0), ((12, 1),
> (3, 49), (12, 17), (12, 17), (12, 17)),Source, Rowcol, SeriesLabels,
> CategoryLabels, Replace)
>          if ret is not None:
>                  ret = Dispatch(ret, 'Add',
> '{0002086B-0000-0000-C000-000000000046}', UnicodeToString=0)
>          return ret
>
> The call to InvokeTypes returns integer 1 rather than a
> PyIDispatch object.

The relevant information is:

(9, 0), ((12, 1), (3, 49), (12, 17), (12, 17), (12, 17))

The (9,0) is the return type.  This translates to VT_DISPATCH.

Is it possible you are tripping over us calling the 'default' method or
property in some cases?  eg:, I could imagine:

sc = chart.SeriesCollection()
n = sc.Add(series_range, seriesAddDirection)
print n

would print '1' in certain cases.  However:
print repr(n)

Would make it more obvious.  It is possible the object has a 'default'
property that is called whenever str() or int() is called on the object.

Mark




More information about the Python-win32 mailing list