| 86 | } |
| 87 | |
| 88 | String PythonInfo::getVersion(const String& python_executable) |
| 89 | { |
| 90 | String v; |
| 91 | QProcess qp; |
| 92 | qp.start(python_executable.toQString(), QStringList() << "--version", QIODevice::ReadOnly); |
| 93 | bool success = qp.waitForFinished(); |
| 94 | if (success && qp.exitStatus() == QProcess::ExitStatus::NormalExit && qp.exitCode() == 0) |
| 95 | { |
| 96 | v = qp.readAllStandardOutput().toStdString(); // some pythons report is on stdout |
| 97 | v += qp.readAllStandardError().toStdString(); // ... some on stderr |
| 98 | v.trim(); // remove '\n' |
| 99 | } |
| 100 | return v; |
| 101 | } |
| 102 | |
| 103 | } // namespace OpenMS |