I want to launch python program with a bunch of arguments from c#. I tried the solution provided in the link: How do I run a Python script from C#? , but it was not working for me. I also tried
public void LaunchProgram(string filepath, string args)
{
Process p = new Process();
p.StartInfo.FileName = "python.exe";
p.StartInfo.UseShellExecute = true; ;
p.StartInfo.Arguments = filepath + " " + args ;
p.Start();
}
However, it is not working either. I would like to know what is the right way to pass a bunch of parameters in this condition? Thanks!
Update: This code is actually part of the wcf service. I got error in the line "p.start();" with the following error:
However, if I put this code in the console application, it works fine. I would like to know whether I need to do something in the service code?
More Update:
I can solve the above problem "The system cannot find the file specified" now by specifying the full path of python. However, if I run my client call the service, my python script is not running and the code does not show me any error either. I would like to know what would the problem this time be? Besides, I would like to know whether there is any good way to debug this kind of problem?