[PyQt] BUG: sip instance attribute error: Re: [eric4] python qscintilla traceback with current snapshot also
Hans-Peter Jansen
hpj at urpla.net
Sun Feb 6 17:24:48 GMT 2011
On Sunday 06 February 2011, 16:40:41 Phil Thompson wrote:
> On Sun, 6 Feb 2011 15:49:59 +0100, "Hans-Peter Jansen"
> <hpj at urpla.net>
>
> wrote:
> >
> > # derive from a sip wrapped class
> > class C(QtCore.QObject):
> > def __init__(self):
> > super(C, self).__init__()
> > # access a non existing attribute results in:
> > # TypeError: 'sip.methoddescriptor' object is not callable
> > try:
> > print self.c, type(self.c)
> > except AttributeError:
> > pass
> >
> > c = C()
> >
> >
> > results in
> >
> > Traceback (most recent call last):
> > File "sipinstance-v2.py", line 38, in <module>
> > c = C()
> > File "sipinstance-v2.py", line 34, in __init__
> > print self.c, type(self.c)
> > TypeError: 'sip.methoddescriptor' object is not callable
> >
> > Instancing QApplication or not doesn't seem to matter here, though.
> >
> > Given, that at least another report for win32 exists, this issue is
> > may be more involved, than it appears on the surface.
> >
> > Pete
>
> It will be related to the new support for __getattr__ in QObject.
>
> You could look at qpycore_qobject_getattr.cpp and see what it is
> returning in the failing case - it should raise the AttributeError
> and return 0.
Hmm, found it. It searches the Qt meta system for matching methods, and
raises the AttributeError if that fails. The behavior seems to stem
from the fact that it finds the offending 'sip.methoddescriptor' for
some reason, and falls flat on its face when trying to call it...
But more importantly, does that mean, that you can reproduce it now?
Pete
More information about the PyQt
mailing list