diff options
-rw-r--r-- | plugins/pythonextensions/pythonextensionsplugin.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/pythonextensions/pythonextensionsplugin.cpp b/plugins/pythonextensions/pythonextensionsplugin.cpp index 3547a59..a230924 100644 --- a/plugins/pythonextensions/pythonextensionsplugin.cpp +++ b/plugins/pythonextensions/pythonextensionsplugin.cpp @@ -162,10 +162,13 @@ QString PythonExtensionsPlugin::pythonPackagePath() void PythonExtensionsPlugin::initializePythonBindings() { // Add our custom module directory - if (extensionDir().exists()) { + if (extensionDir().exists()) PyUtil::addToSysPath(extensionDir().path().toStdString()); - PyUtil::addToSysPath(pythonPackagePath().toStdString()); - } + // Add directory for local python packages that are installed as requirements of extensions + // Need to create it first if it doesn't exist, otherwise python will ignore the path + if (!QFile::exists(pythonPackagePath())) + QDir().mkpath(pythonPackagePath()); + PyUtil::addToSysPath(pythonPackagePath().toStdString()); // Initialize the Python context and register global Qt Creator variable if (!PyUtil::bindShibokenModuleObject("PythonExtension", "QtCreator")) { qWarning() << "Python bindings could not be initialized"; |