Bug report #10610

python console error when using PyQt4 4.11 on Debian

Added by Richard Duivenvoorde almost 9 years ago. Updated almost 9 years ago.

Category:PyQGIS Console
Affected QGIS version:2.2.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:19014


Recently on a fresh QGIS build (both master and 2.2) I cannot open the Python Console anymore.

Traceback (most recent call last):
  File "", line 2, in 
  File "/home/richard/apps/qgis/master/debug/share/qgis/python/console/console.py", line 43, in show_console
    _console = PythonConsole( parent )
  File "/home/richard/apps/qgis/master/debug/share/qgis/python/console/console.py", line 75, in __init__
    self.console = PythonConsoleWidget(self)
  File "/home/richard/apps/qgis/master/debug/share/qgis/python/console/console.py", line 99, in __init__
    self.options = optionsDialog(self)
  File "/home/richard/apps/qgis/master/debug/share/qgis/python/console/console_settings.py", line 33, in __init__
  File "/home/richard/apps/qgis/master/debug/share/qgis/python/console/ui_console_settings.py", line 543, in setupUi
  File "/home/richard/apps/qgis/master/debug/share/qgis/python/console/ui_console_settings.py", line 552, in retranslateUi
    item.setText(_translate("SettingsDialogPythonConsole", "APIs", None))
AttributeError: 'NoneType' object has no attribute 'setText'

After some investigation it looked like the only difference is the (by pyqt4) generated 'ui_console_settings.py' file.

This file is generated from attached 'console_settings.ui' which hasn't changed for some time (at least not between 2.2 and master).

Only difference seems

@ -101,7 +101,7 @@ class Ui_SettingsDialogPythonConsole(object):
-        self.tableWidget.setColumnCount(2)
+        self.tableWidget.setRowCount(0)
         item = QtGui.QTableWidgetItem()
         self.tableWidget.setHorizontalHeaderItem(0, item)
         item = QtGui.QTableWidgetItem()

looks like an error from pyqt4, as 4.11 generated two lines self.tableWidget.setRowCount(0) where one of them should have been self.tableWidget.setColumnCount(2)

attached also the different .py files:

console_settings.ui - ui file used to compile to (also attached py files) (41.6 KB) Richard Duivenvoorde, 2014-06-17 03:14 AM

4.11.ui_console_settings.py Magnifier - 4.11 compiled (42.4 KB) Richard Duivenvoorde, 2014-06-17 03:14 AM

4.10.4.ui_console_settings.py Magnifier - 4.10.4 compiled (42.4 KB) Richard Duivenvoorde, 2014-06-17 03:14 AM


#1 Updated by Jürgen Fischer almost 9 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

fixed in 3f62330

#2 Updated by Richard Duivenvoorde almost 9 years ago

thanks jurgen for this workaround. I have my console back!

Just for completeness, it seems to be a pyqt bug which is suppossed to be fixed in a next release:


Also available in: Atom PDF