[Tutor] Python using RXVT vs Konsole?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Tutor] Python using RXVT vs Konsole?

brandon w-2
I have noticed the difference in terminals when using the Python interpreter.
I am able to up-arrow to get the last typed command using rxvt but when I
use konsole and I press the up-arrow I get the symbols: ^[[A
Why is that? Is this the right place to ask this question? I want to be able to
use the up-arrow in all terminals so I don't have to type as much.

Python os: 2.6.6
OS: Slackware 13.37

Brandon


_______________________________________________
Tutor maillist  -  [hidden email]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Reply | Threaded
Open this post in threaded view
|

Re: [Tutor] Python using RXVT vs Konsole?

Steven D'Aprano-8
On Thu, Mar 08, 2012 at 09:07:46PM -0500, brandon w wrote:
> I have noticed the difference in terminals when using the Python
> interpreter.
> I am able to up-arrow to get the last typed command using rxvt but when I
> use konsole and I press the up-arrow I get the symbols: ^[[A
> Why is that? Is this the right place to ask this question? I want to be
> able to
> use the up-arrow in all terminals so I don't have to type as much.

Assuming you are using the same Python executable in both terminals,
then it isn't a problem with Python, but with the settings for Konsole.
Which surprises me, since I've used Konsole and it just works fine.
(Although if you're using KDE 4, nothing would surprise me...)

Try this, in both terminals:

Start the Python interactive interpreter
Enter import readline

If they both succeed, then the problem is that Konsole is (somehow!) not
using readline when it should be. You may need to ask for help in a KDE
forum.

If you are using two different Python executables, then possibly one of
them is not built using the readline library, in which case you should
install the GNU readline utils package on that machine and re-build
Python.

If none of these things help, you may need to ask the question on the
main Python list, [hidden email] or comp.lang.python.



--
Steven
_______________________________________________
Tutor maillist  -  [hidden email]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Reply | Threaded
Open this post in threaded view
|

Re: [Tutor] Python using RXVT vs Konsole?

brandon w-2
I am using fluxbox an a window manager not KDE. That may have something to do with it.
I will ask in another forum.

Running: >>> import readline in both terminals succeded.

Thank you for your help.

Brandon


On Thu, Mar 8, 2012 at 9:58 PM, Steven D'Aprano <[hidden email]> wrote:
On Thu, Mar 08, 2012 at 09:07:46PM -0500, brandon w wrote:
> I have noticed the difference in terminals when using the Python
> interpreter.
> I am able to up-arrow to get the last typed command using rxvt but when I
> use konsole and I press the up-arrow I get the symbols: ^[[A
> Why is that? Is this the right place to ask this question? I want to be
> able to
> use the up-arrow in all terminals so I don't have to type as much.

Assuming you are using the same Python executable in both terminals,
then it isn't a problem with Python, but with the settings for Konsole.
Which surprises me, since I've used Konsole and it just works fine.
(Although if you're using KDE 4, nothing would surprise me...)

Try this, in both terminals:

Start the Python interactive interpreter
Enter import readline

If they both succeed, then the problem is that Konsole is (somehow!) not
using readline when it should be. You may need to ask for help in a KDE
forum.

If you are using two different Python executables, then possibly one of
them is not built using the readline library, in which case you should
install the GNU readline utils package on that machine and re-build
Python.

If none of these things help, you may need to ask the question on the
main Python list, [hidden email] or comp.lang.python.



--
Steven
_______________________________________________
Tutor maillist  -  [hidden email]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


_______________________________________________
Tutor maillist  -  [hidden email]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Reply | Threaded
Open this post in threaded view
|

Re: [Tutor] Python using RXVT vs Konsole?

Alan Gauld
In reply to this post by brandon w-2
On 09/03/12 02:07, brandon w wrote:

> I am able to up-arrow to get the last typed command using rxvt but when I
> use konsole and I press the up-arrow I get the symbols: ^[[A
> Why is that?

Your terminal settings look like they are messed up.
Does up arrow work in any other applications?
emacs or vim for example?

If not you will need to configure your termcap/terminfo or stty settings
I suspect.

If it does work in other apps then I don't know what's happening!

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  [hidden email]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Reply | Threaded
Open this post in threaded view
|

Re: [Tutor] Python using RXVT vs Konsole?

brandon w-2
Up arrow does work in other applications. The only application that it does not work in is konsole.
I actually do not care for konsole that much. I think I will just use some other terminal.

I found this on the Internet:

The interpreter's line-editing features usually aren't very sophisticated. On Unix, whoever installed the interpreter may have enabled support for the GNU readline library, which adds more elaborate interactive editing and history features. Perhaps the quickest check to see whether command line editing is supported is typing Control-P, or the up-arrow to the first Python prompt you get. If it beeps, you have command line editing; see Appendix A for an introduction to the keys. If nothing appears to happen, or if P is echoed, command line editing isn't available; you'll only be able to use backspace to remove characters from the current line.

http://pytut.infogami.com/node4.html

konsole somehow disabled command line editing.

On Fri, Mar 9, 2012 at 3:49 AM, Alan Gauld <[hidden email]> wrote:
On 09/03/12 02:07, brandon w wrote:

I am able to up-arrow to get the last typed command using rxvt but when I
use konsole and I press the up-arrow I get the symbols: ^[[A
Why is that?

Your terminal settings look like they are messed up.
Does up arrow work in any other applications?
emacs or vim for example?

If not you will need to configure your termcap/terminfo or stty settings I suspect.

If it does work in other apps then I don't know what's happening!
 

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  [hidden email]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


_______________________________________________
Tutor maillist  -  [hidden email]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Reply | Threaded
Open this post in threaded view
|

Re: [Tutor] Python using RXVT vs Konsole?

Alan Gauld
On 10/03/12 15:22, brandon w wrote:
> Up arrow does work in other applications. The only application that it
> does not work in is konsole.

Konsole is a shell, you run applications inside Konsole.
Python is one such application. What I was asking was do the arrow keys
work in other Konsole applications - like vim. (or emacs started with
the -nw option) or pico...

> I actually do not care for konsole that much. I think I will just use
> some other terminal.

That might be the simplest option! :-).

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  [hidden email]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor