I am trying to capture return (list) from python script below using C#. Stream reader gives me a null as a response. However, when I print the result I get the information in stream reader but when I use return(list) it does not.I have tried a lot of ways. Links and any info is appreciated. Python:
def main1():
data1 =send_initdata("i", sock)
list.append (send_data("a", sock,"1"))
list.append (send_data("b", sock,"2"))
#print (list)
return (list)
if __name__ == '__main__':sys.exit(main1())
C#:
void run_cmd()
{
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = @"C:\Python27\python.exe";
start.Arguments = string.Format("{0} {1}", "Function.Py", "");
start.UseShellExecute = false;
start.RedirectStandardOutput = true;
start.CreateNoWindow = true;
using (Process process = Process.Start(start))
{
using (StreamReader reader = process.StandardOutput)
{
var result = reader.ReadLine();
}
}