Don't bug user if R/Python not compatible

.. most users don't care and will freak out.

.. also set PYTHONHOME if user specified (this helps users on
   MacOS use their local modules).
This commit is contained in:
Mark Liversedge
2018-02-15 15:10:30 +00:00
parent 6ede8cc527
commit ef68066f7f
2 changed files with 15 additions and 7 deletions

View File

@@ -177,13 +177,19 @@ PythonEmbed::PythonEmbed(const bool verbose, const bool interactive) : verbose(v
// config or environment variable
QString PYTHONHOME = appsettings->value(NULL, GC_PYTHON_HOME, "").toString();
if (PYTHONHOME == "") PYTHONHOME = QProcessEnvironment::systemEnvironment().value("PYTHONHOME", "");
if (PYTHONHOME !="") printd("PYTHONHOME seteting used: %s\n", PYTHONHOME.toStdString().c_str());
if (PYTHONHOME !="") printd("PYTHONHOME setting used: %s\n", PYTHONHOME.toStdString().c_str());
// is python3 installed?
if (pythonInstalled(pybin, pypath, PYTHONHOME)) {
printd("Python is installed: %s\n", pybin.toStdString().c_str());
// set PYTHONHOME if user specified it
if (PYTHONHOME != "") {
printd("Py_SetPythonHome: %s\n", pybin.toStdString().c_str());
Py_SetPythonHome((wchar_t*) PYTHONHOME.toStdString().c_str());
}
// tell python our program name - pretend to be the usual interpreter
printd("Py_SetProgramName: %s\n", pybin.toStdString().c_str());
Py_SetProgramName((wchar_t*) pybin.toStdString().c_str());
@@ -273,11 +279,12 @@ PythonEmbed::PythonEmbed(const bool verbose, const bool interactive) : verbose(v
// if we get here loading failed
printd("Embedding failed\n");
QMessageBox msg(QMessageBox::Information, QObject::tr("Python not installed or in path"),
QObject::tr("Python v3.6 or higher is required for Python.\nPython disabled in preferences."));
// Don't bug the user -- most of them don't care.
//QMessageBox msg(QMessageBox::Information, QObject::tr("Python not installed or in path"),
// QObject::tr("Python v3.6 or higher is required for Python.\nPython disabled in preferences."));
//msg.exec();
appsettings->setValue(GC_EMBED_PYTHON, false);
loaded=false;
msg.exec();
return;
}

View File

@@ -316,9 +316,10 @@ fail:
R = NULL;
// end embedding
QMessageBox warn(QMessageBox::Information, QObject::tr("R version Incompatible"),
dialogtext + QObject::tr("\nR has been disabled in preferences"));
warn.exec();
// Don't bug the user, most of them don't care
//QMessageBox warn(QMessageBox::Information, QObject::tr("R version Incompatible"),
// dialogtext + QObject::tr("\nR has been disabled in preferences"));
//warn.exec();
}
starting = false;
}