I want to get a variable from my Python file and write it in the console here is what i have tried:
main.py
myVar = "Hello There"
program.cs
using System;
using IronPython.Hosting;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var py = Python.CreateEngine();
var pythonVariable = py.ExecuteFile("main.py");
Console.WriteLine(pythonVariable);
Console.Read();
}
}
}
I would expect the output to be 'Hello There' but I get this: 'Microsoft.Scripting.Hosting.ScriptScope'
main.py? There is no output from that script