[IronPython] Accessing search path through ScriptEngine

2008-03-29 Thread Curt Hagenlocher
The script engine allows you to set the search path by calling ScriptEngine.SetScriptSourceSearchPaths, but it neither lets you query the existing path nor amend it -- just set it outright. Is this intentional? -- Curt Hagenlocher [EMAIL PROTECTED] ___

[IronPython] IP 2 Hosting

2008-03-29 Thread Michael Foord
Hello guys, I'm trying to do some simple examples of hosting with IronPython 2. Boy you made things more complicated than IronPython 1. :-) Unfortunately the DLR hosting spec document is out of date. I have a couple of questions (but will keep exploring). The simplest use case is just to evalu

Re: [IronPython] IP 2 Hosting

2008-03-29 Thread Curt Hagenlocher
Some of those look like names from A9, which have changed in B1. The easiest way to evaluate an expression from scratch seems to be as follows: ScriptEngine engine = ScriptRuntime.Create().GetEngine("py"); ScriptScope scope = engine.CreateScope(); ScriptSource source = engine.CreateSc

Re: [IronPython] IP 2 Hosting

2008-03-29 Thread Michael Foord
Curt Hagenlocher wrote: > Some of those look like names from A9, which have changed in B1. I'm using B1. I expect they'll change in the next release though. *sigh* ;-) In the old days a beta used to mean the API was fixed and it was only bugfixes that would go in... <0.5 wink> Michael > > Th

Re: [IronPython] IP 2 Hosting

2008-03-29 Thread Michael Foord
Curt Hagenlocher wrote: > Some of those look like names from A9, which have changed in B1. > > The easiest way to evaluate an expression from scratch seems to be as > follows: > > ScriptEngine engine = ScriptRuntime.Create().GetEngine("py"); > ScriptScope scope = engine.CreateScope();

Re: [IronPython] IP 2 Hosting

2008-03-29 Thread Curt Hagenlocher
On Sat, Mar 29, 2008 at 10:32 AM, Michael Foord <[EMAIL PROTECTED]> wrote: > > In the old days a beta used to mean the API was fixed and it was only > bugfixes that would go in... <0.5 wink> heh It seems to me that B1 is more consistent with the various published DLR hosting specs than A9 was --

Re: [IronPython] IP 2 Hosting

2008-03-29 Thread Michael Foord
Curt Hagenlocher wrote: > On Sat, Mar 29, 2008 at 10:32 AM, Michael Foord > <[EMAIL PROTECTED]> wrote: > >> In the old days a beta used to mean the API was fixed and it was only >> bugfixes that would go in... <0.5 wink> >> > > heh > > It seems to me that B1 is more consistent with the vari

Re: [IronPython] IP 2 Hosting

2008-03-29 Thread Curt Hagenlocher
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.

Re: [IronPython] IP 2 Hosting

2008-03-29 Thread Michael Foord
((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 engin

[IronPython] IronPython 2 Hosting Examples

2008-03-29 Thread Michael Foord
Hello all, I've written up the IP 2 hosting example (thanks Curt) at: http://www.ironpython.info/index.php/Hosting_IronPython_2 I've created a couple of minimal C# projects for the ACCU talk next week and will post those online at some point. Michael http://www.ironpythoninaction.com _

[IronPython] Snippets in Trackback

2008-03-29 Thread Davy Mitchell
Hi All, IPY2.0 B1 Vista SP1 I keep seeing reference to 'Snippets' in IP Tracebacks on different bits of code. Can't find anything on codeplex so assume it *probably* something wrong this end. I don't have a 'Snippets' module AFAIK. Typical example C:\Code\OSProjects>ipy wpf5.py Traceback (most r

Re: [IronPython] Snippets in Trackback

2008-03-29 Thread Curt Hagenlocher
The "snippets" represent executable code that's generated dynamically by the DLR from your Python source. Do you have a small piece of sample code that reproduces the failure? On Sat, Mar 29, 2008 at 1:28 PM, Davy Mitchell <[EMAIL PROTECTED]> wrote: > Hi All, > > IPY2.0 B1 Vista SP1 > > I keep s

[IronPython] Multiple engines, multiple scopes

2008-03-29 Thread Curt Hagenlocher
Beta 1 now supports multiple engines inside the same AppDomain provided that you create a ScriptRuntime for each: ScriptEngine engine1 = ScriptRuntime.Create().GetEngine("py"); ScriptEngine engine2 = ScriptRuntime.Create().GetEngine("py"); A ScriptScope is loosely equivalent to a Python mo

Re: [IronPython] Snippets in Trackback

2008-03-29 Thread Davy Mitchell
This has the desired effect: import clr clr.AddReference("System.Xml") clr.AddReference("PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35") clr.AddReference("PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35") from System.IO