[PyQt] TypeError with getattr() in 4.8.3
Hans-Peter Jansen
hpj at urpla.net
Thu Mar 10 23:53:27 GMT 2011
On Friday 11 March 2011, 00:44:51 Peter Shinners wrote:
> There is a surprising TypeError using getattr. This only happens when
> the attribute being queried does not exist. This is happening on
> Windows and Osx with Python 2.5
>
> >>> from PyQt4 import QtCore
> >>> obj = QtCore.QObject()
> >>> getattr(obj, "doesNotExist", False)
>
> exceptions.TypeError, 'sip.methoddescriptor' object is not callable
>
> If accessing this attribute directly, the same TypeError is given,
> instead of an expected AttributeError. Note that hasattr() is working
> as expected.
This is a Python bug.
You might want to read this:
http://www.riverbankcomputing.com/pipermail/pyqt/2011-February/029218.html
Pete
More information about the PyQt
mailing list