I am trying to run a simple python code using C# using Iron Python Package.
Why it throws the below error (attached in screenshot)
The code runs fine if i don't import libraries,
but it throws error after importing libraries all tough i have stored required libraries in defined folders
import pandas as pd
print("HIIII")
print(a+b)
using IronPython.Hosting;//for DLHE
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;//provides scripting abilities comparable to batch files
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
using IronPython.Runtime;
using IronPython;
class Hi {
private static void Main(string[] args) {
var engine = Python.CreateEngine();
var searchPaths = engine.GetSearchPaths();
searchPaths.Add(@"C:\Users\nayan.nirvikar\source\repos\PythonCSharpIntegration\Lib");
engine.SetSearchPaths(searchPaths);
var scope = engine.CreateScope();
scope.SetVariable("a", 10);
scope.SetVariable("b", 20);
var source = engine.CreateScriptSourceFromFile(@"C:\Users\nayan.nirvikar\Downloads\sample_script.py");
var compilation = source.Compile();
var result = compilation.Execute(scope);
foreach (var varName in scope.GetVariableNames()){
Console.WriteLine($"Variable: {varName}, Value: {scope.GetVariable(varName)}");
}
}
}
why i am getting error as
future feature is not defined:annotations