[IronPython] Compiling IronPythonConsole.exe

Dino Viehland dinov at microsoft.com
Wed May 6 17:31:01 PDT 2009


The last line should probably be:


cmdLine.Run(Python.CreateEngine(), IronPythonWrapper(), PythonConsoleOptions())
I thought IronPythonWrapper was an instance but it looks like it’s a type – so it needs to be constructed.

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

Hello Ive tried implementing what you suggested with no success

I have attached the source just in case you or anyone can shed some light on it

Cheers

>>> import readline
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Can IT\Desktop\readline.py", line 4, in C:\Users\Can IT\Desktop
\readline.py
  File "C:\Python25\Lib\site-packages\pyreadline\__init__.py", line 9, in C:\Pyt
hon25\Lib\site-packages\pyreadline\__init__.py
  File "C:\Python25\Lib\site-packages\pyreadline\rlmain.py", line 477, in C:\Pyt
hon25\Lib\site-packages\pyreadline\rlmain.py
  File "C:\Python25\Lib\site-packages\pyreadline\console\ironpython_console.py",
 line 408, in install_readline
TypeError: expected IConsole, got type
>>>



On Wed, May 6, 2009 at 2:48 PM, Dino Viehland <dinov at microsoft.com<mailto:dinov at microsoft.com>> wrote:

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-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com> [mailto:users-bounces at lists.ironpython.com<mailto:users-bounces at 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.stenarson at bostream.nu<mailto:jorgen.stenarson at 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 at lists.ironpython.com<mailto:Users at lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20090506/95800fe0/attachment.htm>


More information about the Users mailing list