[IronPython] IronPython Stream

Michael Stephens 89iroc at gmail.com
Mon Jul 14 21:14:21 CEST 2008


I wrote one myself.
Michael Stephens

Electrical Engineering Graduate Student
University of Wyoming
falcon at uwyo.edu or 89iroc at gmail.com

On Mon, Jul 14, 2008 at 1:11 PM, Michael Foord <fuzzyman at voidspace.org.uk>
wrote:

> Michael Stephens wrote:
>
>> I think I ran into some threading issues writing from the stream to the
>> ui.
>>
>
> I can always invoke the write. In this case their are no multi-threading
> concerns. Did you create your own stream or use an existing one?
>
> Michael
>
>  We wrote a callback (delegate) stream handler that we use for ironpython
>> and some odd operations in asp.net <http://asp.net>.  I wish .net made
>> event based streams, and event based collections.
>> Michael Stephens
>>
>> Electrical Engineering Graduate Student
>> University of Wyoming
>> falcon at uwyo.edu <mailto:falcon at uwyo.edu> or 89iroc at gmail.com <mailto:
>> 89iroc at gmail.com>
>>
>>
>> On Mon, Jul 14, 2008 at 12:55 PM, Michael Foord <
>> fuzzyman at voidspace.org.uk <mailto:fuzzyman at voidspace.org.uk>> wrote:
>>
>>    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));
>>      }
>>    }
>>
>>
>>
>>    --    http://www.ironpythoninaction.com/
>>    http://www.voidspace.org.uk/
>>    http://www.trypython.org/
>>    http://www.ironpython.info/
>>    http://www.theotherdelia.co.uk/
>>    http://www.resolverhacks.net/
>>
>>    _______________________________________________
>>    Users mailing list
>>    Users at lists.ironpython.com <mailto: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
>>
>>
>
>
> --
> http://www.ironpythoninaction.com/
> http://www.voidspace.org.uk/
> http://www.trypython.org/
> http://www.ironpython.info/
> http://www.theotherdelia.co.uk/
> http://www.resolverhacks.net/
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080714/903332c4/attachment.html>


More information about the Ironpython-users mailing list