[IronPython] How to integrate IronPython 2.6 to C# program?

Dino Viehland dinov at microsoft.com
Thu Sep 10 05:26:39 CEST 2009


Is it working now for you w/ the Frames = true in the options
then?

For the RC we have a fixed versions of the std lib (thanks to
Michael Foord for fixing it upstream) and we're going to give
a specific error message when _getframe is accessed from sys
but the frames option isn't enabled.

> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-
> bounces at lists.ironpython.com] On Behalf Of KATO Kanryu
> Sent: Wednesday, September 09, 2009 6:57 PM
> To: Discussion of IronPython
> Subject: Re: [IronPython] How to integrate IronPython 2.6 to C#
> program?
> 
> now, I made it about running my C# program with ipy2.6 .
> 
> > Can you include a little more information?
> 
> OK.
> Here are my code and setups.
> 
> ---
> // [1] call sample
> public static int Main(string[] args)
> {
>     var options = new Dictionary<string, object>();
>     options["Frames"] = ScriptingRuntimeHelpers.True;
> 
>     var pythonEngine = Python.CreateEngine(options);
>     var source = pythonEngine.CreateScriptSourceFromFile(args[0],
> System.Text.Encoding.UTF8);
>     var scriptScope = pythonEngine.CreateScope();
>     source.Execute(scriptScope);
>     Console.WriteLine("OK");
>     return 0;
> }
> ...
> 
> [2] Building ipy
> 
> with IronPython_Main\Src\IronPython.Modules_collections.cs
> /// [assembly: PythonModule("collections",
> typeof(IronPython.Modules.PythonCollections))]
> changeing from "_collections" to "collections"
> because of imported by 'threading.py' .
> 
> [3] ipy of options
> 
> Some code arise a error with calling sys._getframe .
> (I cannot specify where of codes arise the error.)
> But ipy 2.6 doesn't define sys._getframe as default.
> We should set the options.
> 
> 
> 
> Currently, a DeprecationWarning arise.
> ---
> ./main.py:1: DeprecationWarning: object.__new__() takes no parameters
> ...
> 
> But it runs faster than one of 2.0 .
> boot time of my program, from 5.7sec to 4.3sec .
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list