1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;
using IronPython.Hosting;
 
namespace WithPython
{
    class MainApp
    {
        static void Main(string[] args)
        {
            ScriptEngine engine = Python.CreateEngine();
            ScriptScope scope = engine.CreateScope();
            scope.SetVariable("n""박성현");
            scope.SetVariable("p""010-123-4566");
 
            ScriptSource source = engine.CreateScriptSourceFromString(
                @"
class NameCard :
    name = ''
    phone = ''
    def _init_(self, name, phone) :
        self.name = name
        self.phone = phone
    def printNameCard(self) :
        print self.name + ',' + self.phone
NameCard(n, p)
");
            dynamic result = source.Execute(scope);
            result.printNameCard();
 
            Console.WriteLine("{0}, {1}", result.name, result.phone);
 
            Console.ReadKey();
        }
    }
}
 
cs



예제 보고 그대로 따라쳤는데 dynamic result = source.Execute(scope); 여기서 예외 처리 안 됐다고 오류 나와요 ㅠㅠ


무슨 C#의 DLR보여준다고 어쩌고 해서.. IronPython 설치하고 참조추가에 dll들 추가하고 예제도 똑같이 쳤는데


왜 오류가 나는 거죠;;;