[IronPython] Embedding IronPython 2.0

Renaud Durand renaud.durand.it at gmail.com
Tue Jan 20 07:32:48 PST 2009


I want to use IronPython function through C#. To do It, I found a tutorial
at http://www.ironpython.info/index.php/Hosting_IronPython_2.
But the code does not seem to be updated for IronPython 2.0.

the code is :

using System;
using IronPython.Hosting;
using IronPython.Runtime;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;

namespace EmbeddedCalculator
    public class Engine
        private ScriptEngine engine;

        public Engine()
            engine = PythonEngine.CurrentEngine;

        public string calculate(string input)
                ScriptSource source =
engine.CreateScriptSourceFromString(input, "py");
                return source.Execute().ToString();
                return "Error";

// End of code

When I try to compile it in visual studio, the compiler could not find the
name "PythonEngine". I have added all the references to
the needed libraries. So, what am I missing ?

Thank you :-).

Renaud Durand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20090120/5b989563/attachment-0001.htm>

More information about the Users mailing list