Bug report #10610

python console error when using PyQt4 4.11 on Debian

Added by Richard Duivenvoorde over 7 years ago. Updated over 7 years ago.

Status:Closed
Priority:Normal
Assignee:-
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

Description

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__
    self.setupUi(self)
  File "/home/richard/apps/qgis/master/debug/share/qgis/python/console/ui_console_settings.py", line 543, in setupUi
    self.retranslateUi(SettingsDialogPythonConsole)
  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.setGridStyle(QtCore.Qt.SolidLine)
         self.tableWidget.setRowCount(0)
         self.tableWidget.setObjectName(_fromUtf8("tableWidget"))
-        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

History

#1 Updated by Jürgen Fischer over 7 years ago

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

fixed in 3f62330

#2 Updated by Richard Duivenvoorde over 7 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:

http://www.riverbankcomputing.com/pipermail/pyqt/2014-June/034400.html

Also available in: Atom PDF