Updated python interface.

This commit is contained in:
NissimHadar 2019-04-23 15:06:17 -07:00
parent 9b8f079899
commit 68f9b473a6
2 changed files with 11 additions and 7 deletions

View file

@ -16,12 +16,16 @@
QString PythonInterface::getPythonCommand() {
#ifdef Q_OS_WIN
if (_pythonCommand.isNull()) {
QString pythonPath = PathUtils::getPathToExecutable("python.exe");
// Use the python launcher as we need python 3, and python 2 may be installed
// See https://www.python.org/dev/peps/pep-0397/
const QString pythonLauncherExecutable{ "py.exe" };
QString pythonPath = PathUtils::getPathToExecutable(pythonLauncherExecutable);
if (!pythonPath.isNull()) {
_pythonCommand = pythonPath + _pythonExe;
} else {
QMessageBox::critical(0, "python.exe not found",
"Please verify that pyton.exe is in the PATH");
}
else {
QMessageBox::critical(0, pythonLauncherExecutable + " not found",
"Please verify that py.exe is in the PATH");
exit(-1);
}
}
@ -35,4 +39,4 @@ QString PythonInterface::getPythonCommand() {
#endif
return _pythonCommand;
}
}

View file

@ -18,7 +18,7 @@ public:
private:
#ifdef Q_OS_WIN
const QString _pythonExe{ "python.exe" };
const QString _pythonExe{ "py.exe" };
#else
// Both Mac and Linux use "python"
const QString _pythonExe{ "python" };
@ -27,4 +27,4 @@ private:
QString _pythonCommand;
};
#endif // hifi_PythonInterface_h
#endif // hifi_PythonInterface_h