((IronPython.PythonEngineOptions)engine.Options).DivisionOptions =
IronPython.PythonDivisionOptions.New;
This worked!
Thanks - it is for a simple embedding example which is a calculator. The
winforms UI builds up expressions and the '=' button evaluates them with
the Python engine. :-)
Michael
Curt Hagenlocher wrote:
> On Sat, Mar 29, 2008 at 10:51 AM, Michael Foord
> <[EMAIL PROTECTED]> wrote:
>
>> Cool - I was just being rude.
>>
>
> Hey, I feel your pain! I'd swear that I've rewritten more hosting
> code than I've written...
>
>
>> Any ideas on switching on TrueDivision for the scope?
>>
>
> This is what I was able to puzzle out. I have no idea how "correct" it is.
> ScriptSource source = engine.CreateScriptSourceFromString("import
> foo", SourceCodeKind.Statements);
> ScriptScope scriptScope = runtime.ExecuteSourceUnit(source);
> Scope scope = scriptScope.GetVariable<Scope>("foo");
> PythonModule extension =
> (PythonModule)scope.GetExtension(scope.Language.ContextId);
> extension.TrueDivision = true;
>
> It looks like you can set this globally by doing something like this:
> ((IronPython.PythonEngineOptions)engine.Options).DivisionOptions =
> IronPython.PythonDivisionOptions.New;
>
> --
> Curt Hagenlocher
> [EMAIL PROTECTED]
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com