using System.Diagnostics;
///
/// Eseguibile dell'interprete python.
///
string python_path = @"C:\Python25\python.exe";
///
/// Script python da eseguire.
///
string pyscript_path = @"C:\ms4w\Apache\htdocs\drawmap_csharp.py";
///
/// Eventuali argomenti allo script.
///
string pyargument1 = "argomento1";
string pyargument2 = @"C:\ms4w\Apache\htdocs\tmp.png";
// Prima di far partire il processo se ne indicano le proprietà
// In questo caso il processo da eseguire è relativo all'eseguibile dell'interprete
ProcessStartInfo startInfo = new ProcessStartInfo(python_path);
// Lo script python e gli argomenti allo script python si passano come argomenti dell'eseguibile
startInfo.Arguments = pyscript_path + " " + pyargument1 + " \"" + pyargument2 + "\"";
// Queste proprietà evitano di mostrare la schermata del prompt durante l'esecuzione
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
// Con queste istruzioni si fa effettivamente partire il processo
Process process = new Process();
process.StartInfo = startInfo;
process.Start();
// Con queste istruzioni ne attendiamo il completamento e lo chiudiamo
process.WaitForExit();
process.Close();