This one’s a little more complex.  It looks like there’s no longer a writable 
IConsole property.  Instead it looks like you need to create a 
PythonCommandLine object and then pass in a ScriptEngine, an IConsole, and a 
ConsoleOptions object.  That’d look something like:

import clr
clr.AddReference(‘IronPython’)
clr.AddReference(‘Microsoft.Scripting’)
from IronPython.Hosting import PythonCommandLine, PythonConsoleOptions, Python
cmdLine = PythonCommandLine()
cmdLine.Run(Python.CreateEngine(), IronPythonWrapper, PythonConsoleOptions())

When you call Run here that will then start the interactive interpreter loop – 
I’m not sure if that’s exactly what you want.  This is also going to create a 
2nd IronPython engine because you can’t really get to the current ScriptEngine 
from within IronPython itself – again there could be reasons why you wouldn’t 
want this to happen.

If you’ve got suggestions on what you’d like the APIs to look like for this 
scenario let us know ☺

From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Andrew Evans
Sent: Wednesday, May 06, 2009 1:36 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Compiling IronPythonConsole.exe

Hello

pyreadline plays an important part in scapy 
(http://www.secdev.org/projects/scapy/) which is what I am porting to 
IronPython. My reason for this is well I like a challenge. That's the only 
reason as self serving as that may seem :-P

Thats the result of my console

Welcome to Scapy (1.2.0.2-win)
☺←[34m←[1m☻>>> ☺←[0m☻


I am not 100 % sure I implented this line correct

"MyConsole = IronPythonWrapper()"

which was previously

IronPythonConsole.PythonCommandLine.MyConsole = IronPythonWrapper()

maybe more experienced people can shed a light on this

when that is solved I can submit a patch :-) I would be happy to


On Wed, May 6, 2009 at 1:20 PM, Jörgen Stenarson 
<jorgen.stenar...@bostream.nu<mailto:jorgen.stenar...@bostream.nu>> wrote:
Andrew Evans skrev:

Hey Stephen thank you

You solved my problem (I had copied pyreadline from previously to the 
ironpython folder.) I modified the file in  the ironpython folder... modifying 
it in the default directory in C:\Python25 fixed it

Thank You :-)

Andrew,

I'm happy to see that someone is trying to use pyreadline (I'm the maintainer 
of pyreadline) on ironpython. I have not tried it myself for a long time so I 
have no idea how much bitrot has crept into it. If you have any patches to make 
it work out of the box I would be happy to include it.

Please file any patches via the bugtracker:
https://bugs.launchpad.net/pyreadline

We use the ipython lists to discuss pyreadline
http://mail.scipy.org/mailman/listinfo/ipython-user
http://mail.scipy.org/mailman/listinfo/ipython-dev


/Jörgen

_______________________________________________
Users mailing list
Users@lists.ironpython.com<mailto:Users@lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to