title: calling python.py from C# .net
body: <p>I have a problem in calling a python script from C#. My python script computes a value based on param 1 and param 2 and sends the computed value. I am not able to get the computed value. say, for example I am taking a simple python class and calling for C# </p>
  
  <p>the below is python.py :</p>
  
  <pre><code>import argparse
  class demo:
  
    def add(self,a,b):
       return a+b
  
  def main(a,b):
   obj=demo()
   value=obj.add(a,b)
   print(value)
   return value
  
  if __name__ == "__main__":
  arg_parse = argparse.ArgumentParser()
  arg_parse.add_argument("a")
  arguments = arg_parse.parse_args()
  main(arguments.a,3)
  </code></pre>
  
  <p>below is the C# code to call it.</p>
  
  <pre><code>Process p = new Process(); 
          int a = 2;
          p.StartInfo.FileName = "C:\\Users\\xyx\\AppData\\Local\\Programs\\Python\\Python36-32\\pythonw\\python.exe";
          p.StartInfo.RedirectStandardOutput = true;
          p.StartInfo.UseShellExecute = false; 
          p.StartInfo.RedirectStandardOutput = true;
          p.StartInfo.RedirectStandardError = true;
          p.StartInfo.CreateNoWindow = true;
          p.StartInfo.Arguments = "C:\\Users\\xyx\\AppData\\Local\\Programs\\Python\\Python36-32\\pythonw\\python.py "+a; parameter
          p.Start(); 
          StreamReader s = p.StandardOutput;
          standardError = s.ReadToEnd();
          output = s.ReadToEnd().Replace(Environment.NewLine, string.Empty); 
  
          p.WaitForExit();
  </code></pre>
  
  <p>Since 2,3 are sent to main () in python, I want '5'back. I do not know how to get it back. Please help</p>