[IronPython] Embedding IronPython 2.0

Michael Foord fuzzyman at voidspace.org.uk
Tue Jan 20 17:37:39 CET 2009


Renaud Durand wrote:
> Ok, Thank you.
>
> Does anyone know where could I find an IronPython Assembly 
> documentation and/or up to date tutorials ?

These tutorials are up to date - except for the one specified as being 
for IP1:

http://www.voidspace.org.uk/ironpython/embedding.shtml

Michael
>
> Thank you again.
>
> 2009/1/20 Curt Hagenlocher <curt at hagenlocher.org 
> <mailto:curt at hagenlocher.org>>
>
>     I believe this was valid for a long-ago alpha.  For the 2.0
>     release, you'll want to create an engine by saying
>     engine = Python.CreateEngine()
>
>     On Tue, Jan 20, 2009 at 7:32 AM, Renaud Durand <renaud.durand.it
>     <http://renaud.durand.it>@gmail.com <http://gmail.com>> wrote:
>
>         Hi,
>
>         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)
>                 {
>                     try
>                     {
>                         ScriptSource source =
>         engine.CreateScriptSourceFromString(input, "py");
>                         return source.Execute().ToString();
>                     }
>                     catch
>                     {
>                         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
>
>         _______________________________________________
>         Users mailing list
>         Users at lists.ironpython.com <mailto:Users at lists.ironpython.com>
>         http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
>     _______________________________________________
>     Users mailing list
>     Users at lists.ironpython.com <mailto:Users at lists.ironpython.com>
>     http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
>
>
> -- 
> Renaud Durand
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>   


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog





More information about the Ironpython-users mailing list