[PyQt] BUG: sip instance attribute error: Re: [eric4] python qscintilla traceback with current snapshot also
Hans-Peter Jansen
hpj at urpla.net
Wed Feb 2 20:33:39 GMT 2011
[Oops, sorry, send too fast]
Dear Phil,
On Tuesday 01 February 2011, 22:26:43 Hans-Peter Jansen wrote:
>
> Phil, something is badly broken with the current release and the
> snapshots.
Here's the essence of the issue:
class A(object):
def __init__(self):
# catch access a non existing attribute
try:
print self.a, type(self.a)
except AttributeError:
pass
a = A()
from PyQt4.Qsci import QsciScintilla
# derive from a sip wrapped class
class B(QsciScintilla):
def __init__(self):
# access a non existing attribute results in:
# TypeError: 'sip.methoddescriptor' object is not callable
try:
print self.b, type(self.b)
except AttributeError:
pass
b = B()
results in:
Traceback (most recent call last):
File "sipinstance.py", line 22, in <module>
b = B()
File "sipinstance.py", line 18, in __init__
print self.b, type(self.b)
TypeError: 'sip.methoddescriptor' object is not callable
Obviously, accessing non existing attributes in classes wrapped by sip
causes havoc (an unexpected TypeError).
At least for:
python: 2.6
sip: 4.12.1
qt4: 4.6.3
pyqt4: snapshot-4.8.4-278054fd857c
I was able to fix eric with this diff:
--- QScintilla/Editor.py~ 2011-02-02 21:31:20.741149390 +0100
+++ QScintilla/Editor.py 2011-02-02 21:31:30.683988621 +0100
@@ -1258,7 +1258,7 @@ class Editor(QsciScintillaCompat):
"""
try:
self.supportedEols[self.getLineSeparator()].setChecked(True)
- except AttributeError:
+ except (AttributeError, TypeError):
pass
def __eolChanged(self):
Note: self.supportedEols doesn't exist, when this method is called the first
time.
Guess, it's sip 4.12.2 time ;-)
Pete
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sipinstance.py
Type: application/x-python
Size: 550 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110202/a49c3d64/attachment.bin>
More information about the PyQt
mailing list