<div>This is a known problem and already filed in CodePlex as <a href="http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=16623">http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=16623</a>.&nbsp; You might be able to guard the stream yourself using locks created through the thread or threading modules.&nbsp; Relevant documentation can be found at <a href="http://docs.python.org/lib/module-thread.html">http://docs.python.org/lib/module-thread.html</a>&nbsp;and <a href="http://docs.python.org/lib/module-threading.html">http://docs.python.org/lib/module-threading.html</a>.</div>

<div>&nbsp;</div>
<div>Only two votes so far, but I think we&#39;d probably want to fix this for 2.0 final.<br></div>
<div class="gmail_quote">On Sat, Jun 28, 2008 at 2:29 AM, Ásgeir Halldórsson &lt;<a href="mailto:asgeir@dcc.is">asgeir@dcc.is</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi,<br><br>&nbsp; &nbsp;I was wondering about one thing I am using this code in many<br>threads. &nbsp;And it does not look like the Stdout is thread safe. &nbsp;Is there<br>
something I can do about it?<br><br>ScriptEngine eng = IronPython.Hosting.PythonEngine.CurrentEngine;<br>ScriptSource source = eng.CreateScriptSourceFromString(codeStr,<br>Microsoft.Scripting.SourceCodeKind.Statements);<br>
code = source.Compile();<br><br>ScriptScope scope = eng.CreateScope();<br><br>MemoryStream ms = new MemoryStream();<br>scope.Engine.Runtime.IO.SetOutput(ms, Encoding.UTF8);<br>code.Execute(scope);<br><br>--<br><br>Regards,<br>
&nbsp; Ásgeir Halldórsson<br><br><br><br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
</blockquote></div><br>