What you’re attempting to do here is define overridden properties for the 
methods on the IConsole interface.  IConsole itself isn’t very well documented 
but the there’s info on properties here: 
http://www.ironpython.info/index.php/Overridable_Properties

I do realize you’re just trying to get someone else’s stuff to work.  If you 
want an experience that just works my guess is that you could use IronPython 
1.x which readline probably works with.  But making something new work is 
always more fun! ☺

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

Where can I find the docs on this

I am not the best coder but maybe the documentation will help me to understand 
what your saying

*cheers

What I understand I need to create the function "get_Output" "set_Output" etc 
but in order for them to return the values would it be

def set_Output():
       set_Output

Anyway once again thank you

btw it isn't my code its a IronPython module I need to work :-)


On Wed, May 6, 2009 at 7:12 PM, Dino Viehland 
<di...@microsoft.com<mailto:di...@microsoft.com>> wrote:

Ahh, I see, there’s new properties on IConsole to get/set the 
Output/ErrorOutput TextWriters.  You can define 
get_Output/set_Output/get_ErrorOutput/set_ErrorOutput methods to implement them 
for the interface on IronPythonWrapper.



They can simply save/return the values and you can ignore it or you can use the 
TextWriter to pick up when the user redirects sys.stdout/sys.stderr.



From: 
users-boun...@lists.ironpython.com<mailto:users-boun...@lists.ironpython.com> 
[mailto:users-boun...@lists.ironpython.com<mailto:users-boun...@lists.ironpython.com>]
 On Behalf Of Andrew Evans
Sent: Wednesday, May 06, 2009 7:01 PM

To: Discussion of IronPython
Subject: Re: [IronPython] Compiling IronPythonConsole.exe



hmm I did a search through the code there is no set_Output and I searched 
Output and set_ as separate search nothing... Now I am confused

Anyway I really appreciate your help :-)

*cheers

Andrew

On Wed, May 6, 2009 at 6:32 PM, Dino Viehland 
<di...@microsoft.com<mailto:di...@microsoft.com>> wrote:

Is there an actual call to a “something.set_Output(…)” method somewhere in the 
code?



If so it should be “something.Output = ….” – in 2.0 we no longer allow calling 
properties

via the property methods.



From: 
users-boun...@lists.ironpython.com<mailto:users-boun...@lists.ironpython.com> 
[mailto:users-boun...@lists.ironpython.com<mailto:users-boun...@lists.ironpython.com>]
 On Behalf Of Andrew Evans
Sent: Wednesday, May 06, 2009 5:56 PM

To: Discussion of IronPython
Subject: Re: [IronPython] Compiling IronPythonConsole.exe



Well I am about ready to give up for the night anyway here is my last error :-)


>>> import sys
>>> sys.path.append(r"C:\Python25\Lib\site-packages")
>>> import readline
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python25\Lib\site-packages\readline.py", line 4, in C:\Python25\Lib\s
ite-packages\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 409, in install_readline
AttributeError: 'IronPythonWrapper' object has no attribute 'set_Output'
>>>

On Wed, May 6, 2009 at 5:31 PM, Dino Viehland 
<di...@microsoft.com<mailto:di...@microsoft.com>> wrote:

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-boun...@lists.ironpython.com<mailto:users-boun...@lists.ironpython.com> 
[mailto:users-boun...@lists.ironpython.com<mailto:users-boun...@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 
<di...@microsoft.com<mailto:di...@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-boun...@lists.ironpython.com<mailto:users-boun...@lists.ironpython.com> 
[mailto: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<mailto:Users@lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



_______________________________________________
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<mailto:Users@lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



_______________________________________________
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