[PyQt] pyqt5.1 baffling exceptions: AttributeError: 'Qxxxxxx' object has no attribute 'QWidget'

Stephen Gava elguavas at gmail.com
Sat Oct 5 07:02:46 BST 2013


hi there,
i posted an earlier question about one specific instance of this problem 
which seemed to relate to using QWidget.childAt() (no replies), but now 
i have the same puzzling issue cropping up in several places in a 
project i have moved from pyqt4 to pyqt5.

under pyqt4 this code ran fine with none of these exceptions.

under pyqt5 i'm getting exceptions of the kind detailed in the message 
title from time to time, ie exceptions where the final error message is:

  AttributeError: 'Qxxxxxx' object has no attribute 'QWidget'

where Qxxxxxx is some kind of widget (in one instance QLabel, in another 
couple of cases QMainWindow).

these errors seem like they might be comming from pyqt5 itself, as i 
don't reference QWidget as an attribute of any labels or mainwindows in 
my own code, however the tracebacks i get only follow the stack in my 
own code, in one instance this exception is thrown after a call to 
QWidget.childAt() and in some other instances after calls to 
QWidget.window()  (which was Qwidget.topLevelWidget() in pyqt4).

as i said the pyqt4 version never throws these exceptions, and i can't 
find anything in my code that should be causing this under pyqt5...

does anyone have any advice on how i can at least try to work out where 
the issue is coming from? it's definitely caused by something 
new/different in ptqt5.

thanks,
stephen.


More information about the PyQt mailing list