[IronPython] IP 2 Hosting
fuzzyman at voidspace.org.uk
Sat Mar 29 20:06:53 CET 2008
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. :-)
Curt Hagenlocher wrote:
> On Sat, Mar 29, 2008 at 10:51 AM, Michael Foord
> <fuzzyman at voidspace.org.uk> 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 =
> extension.TrueDivision = true;
> It looks like you can set this globally by doing something like this:
> ((IronPython.PythonEngineOptions)engine.Options).DivisionOptions =
> Curt Hagenlocher
> curt at hagenlocher.org
> Users mailing list
> Users at lists.ironpython.com
More information about the Ironpython-users