[IronPython] Executing a python source from C#

Keith J. Farmer kfarmer at thuban.org
Fri Apr 29 20:27:29 CEST 2005

I think having a standard interface for creating consoles would be a great way to implement IronPython's console.  Being able to swap in semi-arbitrary languages into FooConsole could be useful for a variety of apps.
public delegate ConsoleInputHandler(string input);
IConsole console = new Console<IronPythonInterpreter>(consoleSettings, consoleHistory);
console.OnInput += new ConsoleInputHandler(OnInput);
public void OnInput(string input)


				case ConsoleState.ContinueLine: { console.Prompt = ConsolePrompt.Continue; break; }
				case ConsoleState.NewLine: { console.ExecuteCurrentLine();  prompt = ConsolePrompt.New; break; }


.. back to Java sloggery.


From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Jim Hugunin
Sent: Fri 4/29/2005 10:46 AM
To: Discussion of IronPython
Subject: RE: [IronPython] Executing a python source from C#

That will generate a SyntaxError just as if you passed a partial block to exec.  If you're interested in experimenting with embeddable consoles, you should take a look at the code for IronPythonConsole which also uses PythonEngine to do its loops.

Ultimately, I think that IronPython should ship with a standard interactive console for both winforms and avalon that have a few customization hooks but are designed to be easily plugged into your apps.  I'm still not sure if this embeddable console should be written in C# or in IronPython itself and am curious to hear the results of experiments using either approach.  I'm leaning towards the idea of building it, and even the standard command-line console, in IronPython.

Thanks - Jim

From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Keith J. Farmer
Sent: Friday, April 29, 2005 10:35 AM
To: Discussion of IronPython
Subject: RE: [IronPython] Executing a python source from C#

What happens if we send in a partial block, as might happen when creating an embeddable console?
string stmt = "for i in range(6):";
Or is it expected that we ensure that such things don't happen?
users-ironpython.com mailing list
users-ironpython.com at lists.ironpython.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 6163 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20050429/916dd39d/attachment.bin>

More information about the Ironpython-users mailing list