Bug report #21464

option --profiles-path when launching QGIS and locale by default involve Qvariant error when activating plugins

Added by Alain FERRATON over 5 years ago. Updated over 5 years ago.

Status:Reopened
Priority:Normal
Assignee:-
Category:GUI
Affected QGIS version:3.4.5 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:29281

Description

I use the --profiles-path option when launching QGIS.

If you do not check the 'override system locale' settings option,
loading any plugin implies the following error:

------------
Impossible de charger l'extension 'AcATaMa' provoque une erreur lors de l'appel à sa méthode classFactory()

TypeError: 'QVariant' object is not subscriptable
Traceback (most recent call last):
File "C:/PROGRA~1/QGIS3~1.4J/apps/qgis-ltr/./python\qgis\utils.py", line 335, in startPlugin
plugins[packageName] = package.classFactory(iface)
File "C:\0_test\profiles\default/python/plugins\AcATaMa\__init__.py", line 33, in classFactory
return AcATaMa(iface)
File "C:\0_test\profiles\default/python/plugins\AcATaMa\acatama.py", line 57, in init
locale = QSettings().value('locale/userLocale')[0:2]
TypeError: 'QVariant' object is not subscriptable
----------------

if you check the option and restart QGIS the error no longer occurs.

This is probably a storage problem of the default locale in the QGIS3.ini file

History

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

  • Resolution set to invalid
  • Status changed from Open to Closed

Alain FERRATON wrote:

File "C:\0_test\profiles\default/python/plugins\AcATaMa\acatama.py", line 57, in init
locale = QSettings().value('locale/userLocale')[0:2]

The plugin implies that there is a override - but that's not always the case - file the issue in the plugin's tracker please.

#2 Updated by Alain FERRATON over 5 years ago

  • Status changed from Closed to Reopened

This is not a problem for the ATACAMA plugin.
That was just one example. The problem occurs for all plugins.

This problem is specific to QGIS 3.4.5 (does not occur under QGIS 3.4.4).
When QGIS creates the QGIS.INI file QGIS.INI under QGIS 3.4.5 the lines

[locale]
userLocale = fr_FR (in my case)

are not created.

#3 Updated by Alain FERRATON over 5 years ago

I suspect that this problem is related to the patch:
https://github.com/qgis/QGIS/pull/9309

#4 Updated by Alain FERRATON over 5 years ago

Even if it is not a long term solution, it is possible to bypass the bug by running QGIS with the --lang option "fr_FR"

Also available in: Atom PDF