Mam następujący C# kod gdzie mogę zadzwonić skrypt Pythona z C#:W jaki sposób przekazywać argumenty do skryptu Pythona z IronPython
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IronPython.Hosting;
using Microsoft.Scripting.Hosting;
using IronPython.Runtime;
namespace RunPython
{
class Program
{
static void Main(string[] args)
{
ScriptRuntimeSetup setup = Python.CreateRuntimeSetup(null);
ScriptRuntime runtime = new ScriptRuntime(setup);
ScriptEngine engine = Python.GetEngine(runtime);
ScriptSource source = engine.CreateScriptSourceFromFile("HelloWorld.py");
ScriptScope scope = engine.CreateScope();
source.Execute(scope);
}
}
}
mam problemy ze zrozumieniem każdy wiersz kodu, ponieważ moje doświadczenie z C# jest ograniczona. Jak zmodyfikować ten kod w celu przekazania argumentu wiersza poleceń do mojego skryptu Pythona, gdy go uruchomię?
Możliwa duplikat https://stackoverflow.com/questions/5949735/how-can-i-pass-command-line-arguments- in-ironpython – IronManMark20