Ver Mensaje Individual
  #3 (permalink)  
Antiguo 12/01/2016, 15:00
Avatar de BlueSkull
BlueSkull
 
Fecha de Ingreso: noviembre-2008
Ubicación: Chile
Mensajes: 504
Antigüedad: 15 años, 5 meses
Puntos: 4
Respuesta: Como ejecutar un script Python en ASP.NET

Excelente gracias lo probe y me quedo asi:
Cita:
string cmdPy = "C:/Python34/python.exe";
string argv = "C:/Python34/hola.py";

ProcessStartInfo start = new ProcessStartInfo();
start.FileName = cmdPy;
start.Arguments = argv;
start.UseShellExecute = false;
start.RedirectStandardOutput = true;
using (Process process = Process.Start(start))
{
using (StreamReader reader = process.StandardOutput)
{
string result = reader.ReadToEnd();
//Console.Write(result);
this.Label1.Text = result;
}
}
Pero me quede con:
Cita:
int x = 1;
int y = 2;

var ipy = Python.CreateRuntime();
var path = Server.MapPath("~/App_Script");
var fullpath = Path.Combine(path, "Operaciones.py");

dynamic op = ipy.UseFile(fullpath);
this.Label1.Text = op.sumar(x, y).ToString();
__________________
"Incluso las torres más altas empiezan en el suelo."
"Sé Ágil..."
StreamWriter