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

Error on install #191

Closed
davidgilbertson opened this issue May 9, 2024 · 3 comments · Fixed by #192
Closed

Error on install #191

davidgilbertson opened this issue May 9, 2024 · 3 comments · Fixed by #192

Comments

@davidgilbertson
Copy link

Hi, I've got a new install of QGIS, tried installing your plugin and got an error after clicking Install in the plugin manager.

Couldn't load plugin 'qgis-maptiler-plugin' due to an error when calling its classFactory() method 

TypeError: 'QVariant' object is not subscriptable 
Traceback (most recent call last):
  File "C:\PROGRA~1/QGIS33~1.5/apps/qgis-ltr/./python\qgis\utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:\Users/david/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis-maptiler-plugin\__init__.py", line 36, in classFactory
    return MapTiler(iface)
  File "C:\Users/david/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis-maptiler-plugin\maptiler.py", line 55, in __init__
    locale = QSettings().value('locale/userLocale')[0:2]
TypeError: 'QVariant' object is not subscriptable


Python version: 3.9.18 (heads/master:5eba59e, Feb  1 2024, 20:02:10) [MSC v.1929 64 bit (AMD64)] 
QGIS version: 3.34.5-Prizren Prizren, 4b308492 

Python Path:
C:/PROGRA~1/QGIS33~1.5/apps/qgis-ltr/./python
C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA~1/QGIS33~1.5/apps/qgis-ltr/./python/plugins
C:\PROGRA~1\QGIS33~1.5\apps\grass\grass83\etc\python
C:\Users\david\Documents
C:\Program Files\QGIS 3.34.5\bin\python39.zip
C:\PROGRA~1\QGIS33~1.5\apps\Python39\DLLs
C:\PROGRA~1\QGIS33~1.5\apps\Python39\lib
C:\Program Files\QGIS 3.34.5\bin
C:\PROGRA~1\QGIS33~1.5\apps\Python39
C:\PROGRA~1\QGIS33~1.5\apps\Python39\lib\site-packages
C:\PROGRA~1\QGIS33~1.5\apps\Python39\lib\site-packages\win32
C:\PROGRA~1\QGIS33~1.5\apps\Python39\lib\site-packages\win32\lib
C:\PROGRA~1\QGIS33~1.5\apps\Python39\lib\site-packages\Pythonwin
C:/Users/david/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/david/Maps/QGIS-Training-Data-master/solution

The plugin gets installed, but not enabled, and if I try and enable it, I get the error again.

@lazaa32
Copy link
Collaborator

lazaa32 commented May 9, 2024

Hi @davidgilbertson it seems like a issue with locales in Windows.
Could you please open Python console in QGIS (Ctrl+Alt+P) and insert these two lines of code and let me know what you get as a result?

from qgis.PyQt.QtCore import QSettings
QSettings().value('locale/userLocale')

image

@davidgilbertson
Copy link
Author

I get NULL.

In settings, I had "Override System Locale" unticked.

I have now ticked it and manually set a locale...

image

...and your plugin installs correctly. (FWIW I didn't need to restart QGIS)

Thanks for pointing me in the right direction.

Should I close this or do you want to add a check for null there?

@lazaa32
Copy link
Collaborator

lazaa32 commented May 9, 2024

Happy to hear you got the plugin working. I didn't even know about this option in settings.
Please, keep the issue open, I will create a bug fix PR and close this issue from the PR.

lazaa32 added a commit that referenced this issue May 17, 2024
lazaa32 added a commit that referenced this issue May 17, 2024
lazaa32 added a commit that referenced this issue May 17, 2024
* #191 handle missing userLocale

* #191 remove breakline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants