How to increase PythonWin v2.0: COM browser limits?
Twan van der Schoot
twanvds at xs4all.nl
Wed Mar 21 23:04:50 CET 2001
It's great to see that a good explaination has been found.
And although I just barely grasp the meaning of your diagnosis, I wonder how
to repair it without causing a 'domino-effect'. As my in-depth knowledge of
Pythonwin and the Python support for win32 is probably not sufficient to
What to say about informing Mark Hammond about this?
"Ben Hutchings" <ben.hutchings at roundpoint.com> wrote in message
news:uhf0o6ptw.fsf at roundpoint.com...
> I wrote:
> > The wrapper for COM enumerators, in true Pythonic style, does not
> > check the size of the collection in advance, but attempts to read
> > items until this yields an error. I think that the category
> > enumerator implementation is reporting the no-more-items error in the
> > wrong way (returning E_OUTOFMEMORY rather than S_FALSE), so the
> > wrapper does not translate it into an IndexError exception which
> > would cause the loop to terminate successfully. OLEView probably
> > just doesn't check for the error but displays what it already got.
> Let me revise that:
> A Python iterator for a COM 'container' is an instance of
> win32com.client.util.Enumerator, which wraps a PyIEnumVARIANT object
> that in turn wraps an IEnumVARIANT interface pointer obtained from the
> container. When an IEnumVARIANT user requests more items than there
> are left, the implementation should return any items that are left,
> with a status code of S_FALSE (not an error code).
> In the case of iteration, Enumerator will request only 1 item each
> time. PyIEnumVARIANT's wrapper function returns a list of items,
> which at the end of iteration will have length 0. Enumerator checks
> for this case and throws an IndexError when it occurs, which is the
> normal way for iteration to end. Unfortunately it appears that this
> specific implementation of IEnumVARIANT returns a status code of
> E_OUTOFMEMORY (an error code), which PyIEnumVARIANT turns into a
> win32types.com_error exception.
> OLEView probably treats this error in the same way as a normal end
> of enumeration, and displays the results it already obtained.
> Any opinions expressed are my own and not necessarily those of Roundpoint.
More information about the Python-list