This is a known problem and already filed in CodePlex as http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=16623. You might be able to guard the stream yourself using locks created through the thread or threading modules. Relevant documentation can be found at http://docs.python.org/lib/module-thread.html and http://docs.python.org/lib/module-threading.html.
Only two votes so far, but I think we'd probably want to fix this for 2.0 final. On Sat, Jun 28, 2008 at 2:29 AM, Ásgeir Halldórsson <[EMAIL PROTECTED]> wrote: > Hi, > > I was wondering about one thing I am using this code in many > threads. And it does not look like the Stdout is thread safe. Is there > something I can do about it? > > ScriptEngine eng = IronPython.Hosting.PythonEngine.CurrentEngine; > ScriptSource source = eng.CreateScriptSourceFromString(codeStr, > Microsoft.Scripting.SourceCodeKind.Statements); > code = source.Compile(); > > ScriptScope scope = eng.CreateScope(); > > MemoryStream ms = new MemoryStream(); > scope.Engine.Runtime.IO.SetOutput(ms, Encoding.UTF8); > code.Execute(scope); > > -- > > Regards, > Ásgeir Halldórsson > > > > _______________________________________________ > Users mailing list > [email protected] > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >
_______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
