Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: 'QVariant' object is not subscriptable #2

Open
UrbanPlan-LDB opened this issue Apr 5, 2023 · 2 comments
Open

Comments

@UrbanPlan-LDB
Copy link

Impossibile caricare il plugin 'selectThemes' a causa di un errore chiamando il metodo classFactory()
Steps to reproduce

  1. First
  2. Second
  3. Third
Traceback (most recent call last):
  File "G:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:\Users/Lucio De Benedictis/AppData/Roaming/QGIS/QGIS3\profiles\Lucio_02_23/python/plugins\selectThemes\__init__.py", line 37, in classFactory
    return selectThemes(iface)
  File "C:\Users/Lucio De Benedictis/AppData/Roaming/QGIS/QGIS3\profiles\Lucio_02_23/python/plugins\selectThemes\selectThemes.py", line 52, in __init__
    self.locale = QSettings().value('locale/userLocale')[0:2]
TypeError: 'QVariant' object is not subscriptable

selectThemes 3.0.1, QGIS 3.30.0-'s-Hertogenbosch on Windows 10

@AlisterH
Copy link

AlisterH commented Jul 7, 2023

The offending line of code should be replaced by this:

self.locale = QgsSettings().value('locale/userLocale', QLocale().name())[0:2]

@AlisterH
Copy link

AlisterH commented Jul 7, 2023

Which itself probably requires:

from qgis.PyQt.QtCore import QLocale
from qgis.core import QgsSettings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants