SystemError: NULL result without error in call_object

Mark Hammond mhammond at skippinet.com.au
Thu May 11 17:10:24 CEST 2000


"Gaetan Corneau" <corg at copernic.com> wrote in message
news:C5A7720BDEB7D3118A5200E018C200A037F6DF at EXCHANGE...

> > You _always_ get a tuple of that size, even when you request only 1.

> I don't understand. Look at the following:

>>> from win32com.client.dynamic import Dispatch
>>> ie = Dispatch("internetexplorer.application")
>>> ie.Navigate("www.copernic.com")
>>> doc = ie.Document
>>> for link in doc.Links:
...     print link
...
>>> link
<COMObject <unknown>>
>>>

> This uses IEnumVariant, and links are IDispatch, not tuples. I don have
to
> write:
> print link[0]

The for loop in Python internally calls IEnumVARIANT::Next(1), and unpacks
it.

Similarly, you can say:

doc.Links[5]

And internally we will call Next() to skip to the 5th element and read it.

EnumVARIANT::Next always returns a tuple.  The magic stuff for an
IDispatch object (which internally calls Next) unpacks this tuple for
you...

Does that make more sense?

> > Have you determined exactly
> > what causes the "null result without error" message?  One
> > guess is that you setup the
> > variant as VT_DISPATCH, but leave a NULL pointer in the
> > variant.

> That's what I thought, but it is not the case. I really return the
correct

I checked the code, and that is indeed impossible.  I would really like to
know how this happened, even if it was a bug in your code, just for the
sake of stability...

Mark.






More information about the Python-list mailing list