[PyQt] Lingering exception
Florian Bruhin
me at the-compiler.org
Wed May 7 15:10:56 BST 2014
Hi,
I faced a very interesting issue with my code, which only seems to
happen on Ubuntu (not Archlinux/Windows 7), with Python 3.3.2, PyQt
5.0.1 and Qt 5.0.2 (though my versions on Arch/Windows might be
newer).
In my source at [1] I get this traceback:
Traceback (most recent call last):
File "./qutebrowser/keyinput/modeman.py", line 231, in eventFilter
if self.mode is None:
AttributeError: 'ModeManager' object has no attribute 'mode'
Now mode is a simple @property:
@property
def mode(self):
"""Read-only property for the current mode."""
if not self._mode_stack:
return None
return self._mode_stack[-1]
self._mode_stack is defined in __init__ so it certainly always exists.
After discovering [2] I catched the AttributeError inside the
property, and got this exception in the "return self._mode_stack[-1]"
line:
AttributeError: _Progress object has no attribute 'QWidget'
(_Progress is defined at [3]). It seems to be a lingering exception,
as doing this before the return fixes it:
try:
raise
except:
pass
According to the helpful folks in #python, PyQt either didn't check
for exceptions when it should have, or it didn't call PyExc_Clear()
after handling one.
I'm pretty certain I never do anything like _Progress.QWidget in
my Python code, so even that exception doesn't make much sense to me.
It only happens when starting the application for half a second or so,
after that it seems fine. ModeManager is an eventFilter on
QApplication.
If you want to experiment yourself:
git clone git://the-compiler.org/qutebrowser/
git checkout 14873285e662ddca685b565368b9e8466c9a316b
(After that commit I work around the error).
If a trimmed down example would help, please let me know. If it works
without one I'd be happy as it'd be quite some work to trim the code
down I'd guess.
Thanks a lot,
Florian
[1] http://git.the-compiler.org/qutebrowser/tree/qutebrowser/keyinput/modeman.py?id=c8fd0937b0f4b695d8c3b6838884f21f14339ffd#n58
[2] http://www.riverbankcomputing.com/pipermail/pyqt/2011-April/029667.html
[3] http://git.the-compiler.org/qutebrowser/tree/qutebrowser/widgets/_statusbar.py#n398
--
() ascii ribbon campaign - stop html mail www.asciiribbon.org
/\ www.the-compiler.org | I love long mails http://email.is-not-s.ms/
If *I* had a hammer, there'd be no more folk singers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140507/980ba1f5/attachment.sig>
More information about the PyQt
mailing list