@@ -45,8 +45,8 @@ void QgsPythonUtils::initPython(QgisInterface* interface)
45
45
runString (" import sys" );
46
46
47
47
// expect that bindings are installed locally, so add the path to modules
48
- QString pythonPath = QgsApplication::pkgDataPath () + " /python " ;
49
- runString (" sys.path.insert(0, \" " + pythonPath + " \" ) " );
48
+ // also add path to plugins
49
+ runString (" sys.path = [ \" " + pythonPath () + " \" , \" " + pluginsPath () + " \" ] + sys.path " );
50
50
51
51
// import SIP
52
52
if (!runString (" from sip import wrapinstance, unwrapinstance" ))
@@ -104,8 +104,6 @@ void QgsPythonUtils::initPython(QgisInterface* interface)
104
104
runString (" iface = wrapinstance(" + QString::number ((unsigned long ) interface) + " , QgisInterface)" );
105
105
runString (" plugins = {}" );
106
106
107
- setPluginsPath (QgsApplication::pluginPath () + " /python" );
108
-
109
107
}
110
108
111
109
void QgsPythonUtils::exitPython ()
@@ -206,18 +204,14 @@ QString QgsPythonUtils::getResult()
206
204
}
207
205
208
206
209
-
210
- void QgsPythonUtils::setPluginsPath (QString path)
207
+ QString QgsPythonUtils::pythonPath ()
211
208
{
212
- mPluginsPath = path;
213
-
214
- // alter sys.path to search for packages & modules in (plugin_dir)/python
215
- runString (" sys.path.insert(0, '" + path + " ')" );
209
+ return QgsApplication::pkgDataPath () + " /python" ;
216
210
}
217
211
218
212
QString QgsPythonUtils::pluginsPath ()
219
213
{
220
- return mPluginsPath ;
214
+ return pythonPath () + " /plugins " ;
221
215
}
222
216
223
217
QString QgsPythonUtils::getPluginMetadata (QString pluginName, QString function)
0 commit comments