[IronPython] DLR: ScriptIO Readonly on ScriptRuntime

Ben Hall ben2004uk at googlemail.com
Tue May 13 23:24:25 CEST 2008


Wow! Can't believe I missed those methods, i'll have another look at
using those now.  Sorry :)

Thanks

Ben

On Tue, May 13, 2008 at 5:20 PM, Dino Viehland
<dinov at exchange.microsoft.com> wrote:
> Bill's still working on getting the hosting spec up to date but hopefully there'll be a refresh soon.
>
> For ScriptIO you can call the Set* methods on the ScriptIO object directly  - SetOutput, SetErrorOutput, SetInput.   There's various overloads that take streams or text writers so that you can provide both binary output or text output - for example if you're a web server and you want to have a language that supports printing a JPG.
>
>
> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ben Hall
> Sent: Tuesday, May 13, 2008 4:48 AM
> To: Discussion of IronPython
> Subject: [IronPython] DLR: ScriptIO Readonly on ScriptRuntime
>
> Hello,
>
> I'm currently playing around with some code involing the ScriptRuntime
> and executing code blocks of code.  What I want, is to be able to
> redirect the output from the script. For example, if a user types
> Print 'Hello World' I want it to be redirected to my outputting
> stream.
>
> To start with, I looked at the hosting spec.  On the ScriptRuntime
> class, it says there are InputStreams, OutputStreams and ErrorStreams
> (pg 30) - great, just want I want!
> http://compilerlab.members.winisp.net/dlr-spec-hosting.pdf
>
> However, looking at Assembly: Microsoft.Scripting.Core,
> Version=1.0.0.2000, ScriptRuntime does not have these properties.
>
> It does however have a ScriptIO property for the ScriptIO class which
> contains all of the streams nicely encapsulated. However, this
> variable is readonly and only has a getter on the property. Is there
> any reason for this? What is the recommended approach now in order to
> get access to the output?  I was hoping I would be able to create my
> own ScriptIO class and assign this to the engine.
>
> Any advice on this would be great!
>
> Thanks
>
> Ben Hall
> Blog.BenHall.me.uk
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
> _______________________________________________
> 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