[IronPython] Redirecting stdout/stderr, but with context

Jeff Slutter jslutter at reactorzero.com
Sat Jan 31 04:17:53 CET 2009


Aha! That looks like exactly what I need! It will take some tweaking of
the code, but this should give me the information I need to route things
properly.

Now, I just need to find out if I can do something similar for
System.Console, but I can live with it if I can't for that one. Python
output was the one I *really* needed.

Thanks Dino!

Dino Viehland wrote:
> Can you run each document on its own thread?
> 
> Oh, it also looks like we actually flow CodeContext through to the caller.  So you could do something like:
> 
> class MyFile {
>         public void write(CodeContext context, string data) {
>                 Scope curScope = context.Scope;         // this gives you the module you're running in
> 
>                 // handle write here keyed off of the scope object
>         }
> }
> 
> And replace sys.stdout with that.



More information about the Ironpython-users mailing list