[IronPython] Generated IL is always using the standard input, output and error streams.

Szymon Kobalczyk s.kobalczyk at softwaremind.pl
Fri Apr 28 07:09:42 CEST 2006


Dino Viehland napisał(a):
>
> The engine does have a SetStderr / SetStdout / SetStdin API which should be used for this purpose.  And the nice thing is as we rev to the multi-System state module this API will remain unchanged so you won't be broken in the future.
>   
Note that I the sample I've sent you, I use this API in 
PythonConsole_Load to initialize it with TexboxStreams like this:

                engine = new PythonEngine();
                engine.MyConsole = this;

                engine.SetStdout(new TextboxStream(this.output, false));
                engine.SetStderr(new TextboxStream(this.output, true));

This API is the preferred way to get output from IronPython code. But 
when you create a console there is additional text that engine may want 
to output like command prompts. For this I also implement IConsole 
interface on the PythonConsole  control. It also allows the engine to 
collect interactive input.
Szymon.







More information about the Ironpython-users mailing list