could not load file or assembly 'python.runtime' or one of its dependencies ,an attempt was made to load a program with an in correct format
im am facing same problem, My error was not resolved using phyton 3.5 , calling the phyton.exe path to execute phyton file in .net c# controller ,facing error only after publishing in to the server ,it working fine in my system
below was my code
if (Result.Success)
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "C:/Program Files/Python 3.5/python.exe";
startInfo.Arguments = "C:/PythonScripts/Test.py";
// startInfo.Arguments = HttpContext.Server.MapPath("~/PythonScripts/Test.py").ToString();
startInfo.Verb = "runas";
startInfo.UseShellExecute = false;
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardOutput = true;
process.StartInfo = startInfo;
bool t = process.Start();
StreamReader myStreamReader = process.StandardError;
string error = myStreamReader.ReadToEnd();
StreamReader reader = process.StandardOutput;
string output = reader.ReadToEnd();
process.WaitForExit();
process.Close();
if (!error.Equals(""))
{
Result.Success = false;
Result.Exception = true;
}
}