[IronPython] IronPython Stream
falcon at uwyo.edu
Mon Jul 14 12:09:45 PDT 2008
I think I ran into some threading issues writing from the stream to the ui.
We wrote a callback (delegate) stream handler that we use for ironpython and
some odd operations in asp.net. I wish .net made event based streams, and
event based collections.
Electrical Engineering Graduate Student
University of Wyoming
falcon at uwyo.edu or 89iroc at gmail.com
On Mon, Jul 14, 2008 at 12:55 PM, Michael Foord <fuzzyman at voidspace.org.uk>
> Hello all,
> I'm diverting the standard ouput and standard error streams on a Python
> engine. I would like to provide a Stream that executes a callback on every
> write (rather than just collecting output as most of the examples show).
> Inheriting from 'Stream' is easy but requires implementing a tedious number
> of methods and properties. Inheriting from 'MemoryStream' and only
> overriding 'Write' (plus the constructor) works fine. I'm wondering if it is
> 'correct'? It is probably an abuse of MemoryStream - can this approach fail?
> internal class PythonStream: MemoryStream
> TextBox _output;
> public PythonStream(TextBox textbox)
> _output = textbox;
> public override void Write(byte buffer, int offset, int count)
> _output.AppendText(Encoding.UTF8.GetString(buffer, offset, count));
> Users mailing list
> Users at lists.ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users