[IronPython] DLR: ScriptIO Readonly on ScriptRuntime

Ben Hall ben2004uk at googlemail.com
Tue May 13 13:47:59 CEST 2008


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



More information about the Ironpython-users mailing list