<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Try SourceCodeKind.SingleStatement in the call to
CreateScriptScopeFromString.<br>
<br>
L8r, Paul<br>
<br>
JoeSox wrote:
<blockquote
cite="mid:785694cd0805261545o6be3b8b4k612968014a3fd395@mail.gmail.com"
type="cite">
<pre wrap="">Dino,
This way is not playing well with an overriding System.IO.Stream class
I have written. I set SetOutput with this class which has a delegate
listening for the output. I do 'source.Execute(scope);' but it doesn't
seem to be doing the same thing as ExecuteToConsole (flushing). Any
ideas on what the difference is?
In IP1.1 I used to use ExecuteToConsole and the output stream was updated.
Here is some of the basic code I am using to give some better idea on
what I am talking about:
-------------------------------------
public ScriptEngine engine = ScriptRuntime.Create().GetEngine("py");
public ScriptScope scope;
scope = engine.CreateScope();
//IPEStreamWrapper:Stream, and take delegate IPEngineResponse
engine.Runtime.IO.SetOutput(new
ITB2.IPEWrapper.IPEStreamWrapper(IPEWrapper.IPEStreamWrapper.IPEngineResponse),
engine.Runtime.IO.InputEncoding);
        
ScriptSource source = engine.CreateScriptSourceFromString(command,
SourceCodeKind.Expression);
object o = source.Execute(scope);
IPEStreamWrapper.sbOutput.ToString(); //nothing, I don't see any
MemoryStream Flushing in IPEStreamWrapper Stream class
-------------------------------------
Thanks, Joe
On 4/17/08, Dino Viehland <a class="moz-txt-link-rfc2396E" href="mailto:dinov@exchange.microsoft.com"><dinov@exchange.microsoft.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
You want
ScriptRuntime.IO.SetOutput/ScriptRuntime.IO.SetError which
will let you set the I/O used for all the ScriptEngine's running in the
given ScriptRuntime. You also now need to provide either a Stream and an
Encoding or a Stream and a TextWriter. The reason for that is to support
both text and binary output for scenarios such as PHP wanting to print a
JPG.
From: <a class="moz-txt-link-abbreviated" href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>
[<a class="moz-txt-link-freetext" href="mailto:users-bounces@lists.ironpython.com">mailto:users-bounces@lists.ironpython.com</a>] On Behalf Of
David Seruyange
Sent: Thursday, April 17, 2008 10:59 AM
To: IronPython IronPython
Subject: [IronPython] Redirecting input/output in IronPython 2.x
Hey everyone,
looking at a lot of the samples online I see the following:
pythonEngine.SetStandardError(s);
</pre>
</blockquote>
<pre wrap=""><!----> pythonEngine.SetStandardOutput(s);
</pre>
<blockquote type="cite">
<pre wrap="">
where s is some stream. The Python Engine doesn't seem to support that
method when I make a reference to IronPython 2.0. Am I missing something or
are the online resources now obsolete?
Thanks much -
David
________________________________
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
now.
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a>
<a class="moz-txt-link-freetext" href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>