In our newest 3Di Modeller Interface installer, we have moved the locale settings to qgis_global_settings.ini, so that if a user creates a new user profile, it is always in English.
Now if you try to read the locale settings from QGIS3.ini using a QSettings object, it will not find this setting and return None. This then leads this this error:
Couldn't load plugin 'threedi_models_and_simulations' due to an error when calling its classFactory() method
TypeError: 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "C:\PROGRA~1/3DIMOD~1.28/apps/qgis-ltr/./python\qgis\utils.py", line 423, in _startPlugin
plugins[packageName] = package.classFactory(iface)
File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\will it be english/python/plugins\threedi_models_and_simulations\__init__.py", line 18, in classFactory
return ThreediModelsAndSimulations(iface)
File "C:\Users\leendert.vanwolfswin\AppData\Roaming\3Di\QGIS3\profiles\will it be english/python/plugins\threedi_models_and_simulations\threedi_models_and_simulations.py", line 39, in __init__
locale = QSettings().value("locale/userLocale")[0:2]
TypeError: 'NoneType' object is not subscriptable
Is the locale used by the plugin? If not, please remove this code; if it is used, please fix this. According to @benvanbasten-ns, using a QgsSettings object instead of QSettings would be the way
In our newest 3Di Modeller Interface installer, we have moved the locale settings to
qgis_global_settings.ini
, so that if a user creates a new user profile, it is always in English.Now if you try to read the locale settings from
QGIS3.ini
using a QSettings object, it will not find this setting and return None. This then leads this this error:Is the locale used by the plugin? If not, please remove this code; if it is used, please fix this. According to @benvanbasten-ns, using a
QgsSettings
object instead ofQSettings
would be the wayhttps://github.com/nens/threedi-api-qgis-client/blob/c88e47d5b44f1fb76da21d77efb3bfe7d8621b2a/threedi_models_and_simulations/threedi_models_and_simulations.py#L39