Commit f2e9760c authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

On windows, the official Python3 package installs the executable as "python", not "python3".

"python3" points to the buggy microsoft store python version. Should fix speech to text configuration and install steps on Windows
parent 5ce65477
Pipeline #52977 canceled with stage
......@@ -8,7 +8,7 @@ missing = required - installed
print ("Missing pachages: ", missing)
if missing and len(sys.argv) > 1 :
# install missing modules
print ("Installing missing pachages: ", missing)
print ("Installing missing packages: ", missing)
python = sys.executable
subprocess.check_call([python, '-m', 'pip', 'install', *missing], stdout=subprocess.DEVNULL)
elif len(sys.argv) > 1 :
......
......@@ -1761,7 +1761,11 @@ void KdenliveSettingsDialog::initSpeechPage()
});
connect(this, &KdenliveSettingsDialog::showSpeechMessage, this, &KdenliveSettingsDialog::doShowSpeechMessage);
connect(m_voskAction, &QAction::triggered, [this]() {
#ifdef Q_OS_WIN
QString pyExec = QStandardPaths::findExecutable(QStringLiteral("python"));
#else
QString pyExec = QStandardPaths::findExecutable(QStringLiteral("python3"));
#endif
if (pyExec.isEmpty()) {
doShowSpeechMessage(i18n("Cannot find python3, please install it on your system."), KMessageWidget::Warning);
return;
......@@ -1830,10 +1834,11 @@ void KdenliveSettingsDialog::initSpeechPage()
void KdenliveSettingsDialog::checkVoskDependencies()
{
#ifdef Q_OS_WIN
QString pyExec = QStandardPaths::findExecutable(QStringLiteral("python"));
#else
QString pyExec = QStandardPaths::findExecutable(QStringLiteral("python3"));
if (pyExec.isEmpty()) {
pyExec = QStandardPaths::findExecutable(QStringLiteral("python"));
}
#endif
if (pyExec.isEmpty()) {
doShowSpeechMessage(i18n("Cannot find python3, please install it on your system."), KMessageWidget::Warning);
return;
......
......@@ -89,7 +89,11 @@ SpeechDialog::~SpeechDialog()
void SpeechDialog::slotProcessSpeech(QPoint zone)
{
#ifdef Q_OS_WIN
QString pyExec = QStandardPaths::findExecutable(QStringLiteral("python"));
#else
QString pyExec = QStandardPaths::findExecutable(QStringLiteral("python3"));
#endif
if (pyExec.isEmpty()) {
speech_info->removeAction(m_voskConfig);
speech_info->setMessageType(KMessageWidget::Warning);
......
......@@ -44,14 +44,19 @@ bool OtioConvertions::getOtioConverters()
"listed in PATH environment variable"));
return false;
}
if(QStandardPaths::findExecutable(QStringLiteral("python3")).isEmpty()) {
#ifdef Q_OS_WIN
QString pyExec = QStandardPaths::findExecutable(QStringLiteral("python"));
#else
QString pyExec = QStandardPaths::findExecutable(QStringLiteral("python3"));
#endif
if(pyExec.isEmpty()) {
KMessageBox::error(pCore->window(), ("Could not find \"python3\" executable, needed for OpenTimelineIO adapters.\n"
"If already installed, check it is installed in a directory"
"listed in PATH environment variable"));
return false;
}
QProcess listAdapters;
listAdapters.start(QStringLiteral("python3"));
listAdapters.start(pyExec);
listAdapters.write(QStringLiteral(
"from opentimelineio import *\n"
"for a in plugins.ActiveManifest().adapters:\n"
......
  • After deleting kdenliverc Kdenlive find now Python and speech-to-text without problems and without any pop up window. Looks good.

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment