Hello
What should I do about error CS0234?
What should I do about error CS0234?
C#:
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.Management;
// IronPython
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;
using IronPython;
using IronPython.Hosting;
using IronPython.Runtime;
using IronPython.Modules;
using System.Xml.XPath;
namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
var engine = IronPython.Hosting.Python.CreateEngine();
var scope = engine.CreateScope();
var paths = engine.GetSearchPaths();
paths.Add(@"C:\Users\abc\AppData\Local\Programs\Python\Python310");
paths.Add(@"C:\Users\abc\AppData\Local\Programs\Python\Python310\DLLs");
paths.Add(@"C:\Users\abc\AppData\Local\Programs\Python\Python310\Lib");
paths.Add(@"C:\Users\abc\AppData\Local\Programs\Python\Python310\Lib\site-packages");
paths.Add(@"C:\Users\abc\AppData\Local\Programs\Python\Python310\Lib\site-packages\pandas");
paths.Add(@"C:\Users\abc\AppData\Local\Programs\Python\Python310\Lib\site-packages\numpy");
paths.Add(@"C:\Users\abc\AppData\Local\Programs\Python\Python310\Lib\site-packages\matplotlib");
paths.Add(@"C:\Users\abc\AppData\Local\Programs\Python\Python310\Lib\site-packages\statsmodels");
engine.SetSearchPaths(paths);
var source = engine.CreateScriptSourceFromFile(@"C:\Users\abc\Untitled-1.py");
source.Execute(scope);
var getPythonFuncResult = scope.GetVariable<Func<string>>("getPythonFunc");
var sum = scope.GetVariable<Func<int, int, int>>("sum");
Console.WriteLine(sum(1, 2));
var test_arry = scope.GetVariable<Func<byte[], IronPython.Runtime.List>>("test_arry");
IronPython.Runtime.List list = new IronPython.Runtime.List();
list = test_arry(new byte[4] { 0, 1, 2, 3 });
}
}
}