Replies: 1 comment
-
You're missing the var result = await Cli.Wrap("python")
.WithArguments(new[] { "C:/Users/python_scripts/main.py" })
.ExecuteBufferedAsync(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm trying to run a python script from command line.
I was able to do it without CliWrap as following reported:
public void ExecutePythonCommand()
{
Process p = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/c "python "C:\Users\python_scripts\main.py"";
p.StartInfo = startInfo;
p.Start();
}
With CliWrap I'm not able to understand which is the proper way to run it. I tried for example the following codes:
example1:
var result = await Cli.Wrap("cmd.exe")
.WithArguments(arguments: "python C:/Users/python_scripts/main.py")
.ExecuteBufferedAsync();
example2:
var result = Cli.Wrap("cmd.exe")
.WithArguments("python main.py")
.WithWorkingDirectory("C:\Users\python_scripts")
.ExecuteAsync();
It would be great if someone could clarify if I'm doing some mistake. Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions