mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +00:00
Initialize python home before calling any python primitive (#672)
This commit is contained in:
parent
c6260b5dcb
commit
66dcaea5bb
@ -25,6 +25,10 @@ JupyterConnection *JupyterConnection::getInstance()
|
||||
|
||||
JupyterConnection::JupyterConnection(QObject *parent) : QObject(parent)
|
||||
{
|
||||
/* Will be removed/reworked with python plugins PR */
|
||||
initPythonHome();
|
||||
initPython();
|
||||
qDebug() << "Python init";
|
||||
}
|
||||
|
||||
JupyterConnection::~JupyterConnection()
|
||||
@ -46,8 +50,7 @@ JupyterConnection::~JupyterConnection()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JupyterConnection::initPython()
|
||||
void JupyterConnection::initPythonHome()
|
||||
{
|
||||
#if defined(APPIMAGE) || defined(MACOS_PYTHON_FRAMEWORK_BUNDLED)
|
||||
if (customPythonHome.isNull()) {
|
||||
@ -72,6 +75,10 @@ void JupyterConnection::initPython()
|
||||
Py_SetPythonHome(pythonHome);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void JupyterConnection::initPython()
|
||||
{
|
||||
PyImport_AppendInittab("cutter", &PyInit_api);
|
||||
PyImport_AppendInittab("cutter_internal", &PyInit_api_internal);
|
||||
Py_Initialize();
|
||||
|
@ -54,6 +54,7 @@ private:
|
||||
|
||||
wchar_t *pythonHome = nullptr;
|
||||
|
||||
void initPythonHome();
|
||||
void initPython();
|
||||
void createCutterJupyterModule();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user