diff options
Diffstat (limited to 'GUI')
| -rw-r--r-- | GUI/GUI/GUI/Frame.cpp | 1 | ||||
| -rw-r--r-- | GUI/GUI/GUI/PythonWrapper.cpp | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/GUI/GUI/GUI/Frame.cpp b/GUI/GUI/GUI/Frame.cpp index f32f658..47fe624 100644 --- a/GUI/GUI/GUI/Frame.cpp +++ b/GUI/GUI/GUI/Frame.cpp @@ -1498,6 +1498,7 @@ void Frame::OnSetupPython(wxCommandEvent& event) "-m pip",
"install",
"-r Resources/Scripts/requirements.txt",
+ "--no-warn-script-location",
}, std::move(cb));
if (!p) {
Log(transcribe_out_, "Failed to launch environment setup thread!\n");
diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp index c4b2b55..148692a 100644 --- a/GUI/GUI/GUI/PythonWrapper.cpp +++ b/GUI/GUI/GUI/PythonWrapper.cpp @@ -274,6 +274,20 @@ bool PythonWrapper::InvokeCommandWithArgs(const std::string& cmd, return false; } } + std::filesystem::path py_bin = (std::filesystem::current_path() / + "Resources\Python\Scripts").lexically_normal(); + if (env.find(py_bin.string()) == std::string::npos) { + env += ";" + py_bin.string(); + + // Add updated PATH to current process's environment + if (!SetEnvironmentVariableA("PATH", env.c_str())) { + std::ostringstream err_oss; + err_oss << "Error while executing python command \"" << cmd_oss.str() + << "\": Failed to add git to PATH: " << GetWin32ErrMsg() << std::endl; + out_cb("", err_oss.str()); + return false; + } + } } std::string cmd_str = cmd_oss.str(); |
