I am making an application with visual c# in the front end and Python executing the scripts in the back end. I wanted to pass one value from Visual c# form as an argument to a Python script. The Python script should process the value and should return the processed value to Visual c#. The value should be displayed in the visual c# form.
For the first thing, I wrote a dirty code where python script is executed when the form is loaded and store the value in a text file. Python script will use the value to calculate. But I am not able to return the value to c#.
The code which I wrote for the first logic is:
Process process = new Process();
process.StartInfo.CreateNoWindow = false;
process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
process.StartInfo.FileName = @"C:\c#\Work\RulesValidator\RulesValidator\Asset_Id.py";
try
{
process.Start();
}
catch (Exception ex)
{
System.Console.WriteLine(ex.Message);
}
asset_id.Text = System.IO.File.ReadAllText(@"C:\c#\Work\RulesValidator\RulesValidator\Asset_Id.txt");