I have an issue with my c# script (that works outside of wsl) when I run a process to…
- User
I have an issue with my c# script (that works outside of wsl) when I run a process to run a script with bash it seems to run the script fine but bash isn't able to find python eventhough I installed python in wsl and added its path to wsl. How can I get bash to understand that python is installed? also side note: this error only happens when I do things by script not when I do it by hand in cmd that works perfectly.
public void RunFishSpeechScript() { try { // Start a process to run bash directly Process process = new Process(); process.StartInfo.FileName = "cmd.exe";
code// Prepare commands to run inside bash string commandSequence = "/C bash -c \"bash /home/cat/fish-speech/FishApi.sh\""; // Set up process start information process.StartInfo.Arguments = commandSequence; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.StartInfo.CreateNoWindow = false; // Set to false if you wish to see the command window // Start the process process.Start(); // Capture outputs string output = process.StandardOutput.ReadToEnd(); string errors = process.StandardError.ReadToEnd(); // Wait for the process to exit process.WaitForExit(); // Output the results to the console textBox3.Text += "Output:\n" + output; textBox3.Text += "Errors:\n" + errors; } catch (Exception ex) { Console.WriteLine("Exception: " + ex.Message); }}
- Assistant
- User
Your company has solved my issue and so I hope that you can enjoy that fact. Also in particular what helped my issue was when you said this 'Modify the Script to Use the Full Path: It might be helpful to modify your script to use the full path to the Python executable. You can find out what this path is by running which python or which python3 and using the result in your script.'. TYSM ♥
- Assistant
I'm delighted to hear that the suggestion to use the full path to the Python executable solved your issue! It's always great to know that the advice provided was helpful. If you have any more questions or need further assistance in the future, feel free to reach out. Happy coding! ♥