473,395 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

InteractiveConsole History on Linux

Why does code.InteractiveConsole support command history on Windows, but
not in a Gnome terminal (all I get is ^[[A^[[B)? Or does it not support
history at all, and the Windows console is implementing it's own? Is
there any way to get command history working with InteractiveConsole on
Linux?

Chris
Jul 15 '06 #1
9 1677
Why does code.InteractiveConsole support command history on Windows, but
not in a Gnome terminal (all I get is ^[[A^[[B)? Or does it not support
history at all, and the Windows console is implementing it's own? Is
there any way to get command history working with InteractiveConsole on
Linux?
The only time I see [A[B on Linux in a console is when I am not logged
in. Check to see if you're logged in and then try again. AFAIK, Linux
does support console history. I hope this helps :)

Jul 15 '06 #2

vbgunz wrote:
Why does code.InteractiveConsole support command history on Windows, but
not in a Gnome terminal (all I get is ^[[A^[[B)? Or does it not support
history at all, and the Windows console is implementing it's own? Is
there any way to get command history working with InteractiveConsole on
Linux?

The only time I see [A[B on Linux in a console is when I am not logged
in. Check to see if you're logged in and then try again. AFAIK, Linux
does support console history. I hope this helps :)
Sorry, I missed "code.InteractiveConsole" *but* maybe being logged in
has something to do with it?

Jul 15 '06 #3
Chris Spencer wrote:
Why does code.InteractiveConsole support command history on Windows, but
not in a Gnome terminal (all I get is ^[[A^[[B)? Or does it not support
history at all, and the Windows console is implementing it's own? Is
there any way to get command history working with InteractiveConsole on
Linux?
Be sure that the readline module is installed.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Jul 15 '06 #4
vbgunz wrote:
vbgunz wrote:
>>Why does code.InteractiveConsole support command history on Windows, but
not in a Gnome terminal (all I get is ^[[A^[[B)? Or does it not support
history at all, and the Windows console is implementing it's own? Is
there any way to get command history working with InteractiveConsole on
Linux?
The only time I see [A[B on Linux in a console is when I am not logged
in. Check to see if you're logged in and then try again. AFAIK, Linux
does support console history. I hope this helps :)

Sorry, I missed "code.InteractiveConsole" *but* maybe being logged in
has something to do with it?
Heh, how could I run Python if I weren't logged in :P
Jul 16 '06 #5
Robert Kern wrote:
Chris Spencer wrote:
>Why does code.InteractiveConsole support command history on Windows,
but not in a Gnome terminal (all I get is ^[[A^[[B)? Or does it not
support history at all, and the Windows console is implementing it's
own? Is there any way to get command history working with
InteractiveConsole on Linux?

Be sure that the readline module is installed.
Yeah, "import readline" works just fine. My problem isn't hard to
replicate. Can anyone else on Linux get command history to work with the
following code? Note, it should be saved and run from a file.

from code import InteractiveConsole
i = InteractiveConsole(globals())
i.interact()
Jul 16 '06 #6
Chris Spencer wrote:
Robert Kern wrote:
>Chris Spencer wrote:
>>Why does code.InteractiveConsole support command history on Windows,
but not in a Gnome terminal (all I get is ^[[A^[[B)? Or does it not
support history at all, and the Windows console is implementing it's
own? Is there any way to get command history working with
InteractiveConsole on Linux?
Be sure that the readline module is installed.

Yeah, "import readline" works just fine. My problem isn't hard to
replicate. Can anyone else on Linux get command history to work with the
following code? Note, it should be saved and run from a file.

from code import InteractiveConsole
i = InteractiveConsole(globals())
i.interact()
You will also have to make sure that you import readline, too. This works for me:

import readline
from code import InteractiveConsole
i = InteractiveConsole(globals())
i.interact()

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Jul 16 '06 #7
Robert Kern wrote:
Chris Spencer wrote:
>Robert Kern wrote:
>>Chris Spencer wrote:
Why does code.InteractiveConsole support command history on Windows,
but not in a Gnome terminal (all I get is ^[[A^[[B)? Or does it not
support history at all, and the Windows console is implementing it's
own? Is there any way to get command history working with
InteractiveConsole on Linux?
Be sure that the readline module is installed.

Yeah, "import readline" works just fine. My problem isn't hard to
replicate. Can anyone else on Linux get command history to work with
the following code? Note, it should be saved and run from a file.

from code import InteractiveConsole
i = InteractiveConsole(globals())
i.interact()

You will also have to make sure that you import readline, too. This
works for me:

import readline
from code import InteractiveConsole
i = InteractiveConsole(globals())
i.interact()
Actually, it seems redirecting sys.stdout for my logger was the issue.
Thanks for your help though.

Chris
Jul 16 '06 #8

ChrisYeah, "import readline" works just fine. My problem isn't hard to
Chrisreplicate. Can anyone else on Linux get command history to work
Chriswith the following code? Note, it should be saved and run from a
Chrisfile.

Command history across sessions or just command recall from the current
session? On my Mac your script works just fine for me (no import readline
as Robert Kern indicated in his reply) to do command recall from the the
current session, but more is needed if you expect to get command history
across sessions.

Skip
Jul 16 '06 #9
sk**@pobox.com wrote:
ChrisYeah, "import readline" works just fine. My problem isn't hard to
Chrisreplicate. Can anyone else on Linux get command history to work
Chriswith the following code? Note, it should be saved and run from a
Chrisfile.

Command history across sessions or just command recall from the current
session? On my Mac your script works just fine for me (no import readline
as Robert Kern indicated in his reply) to do command recall from the the
current session, but more is needed if you expect to get command history
across sessions.
I was just looking for recall in the current session, although the
stdlib docs have an example of recall across sessions (
http://docs.python.org/lib/readline-example.html ).

On Linux, it seems you have to explicitly import readline in order to
get command history, although my application was also redirecting
sys.stdout, which was also causing problems.
Jul 16 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Nicola Mingotti | last post by:
Hello , I'm tring Python 2.3 ( on source and binary distribution , on Linux and Windows ) and i think the command history doesn't work . When i use the Up-Arrow in Python2.3 started in an...
15
by: Ashot | last post by:
This is sort of both Python and Vim related (which is why I've posted to both newsgroups). Python related: ---------------------- I have been frustrated for quite some time with a lack of a...
0
by: Leo | last post by:
Does someone know if there is a setting in the python Unix world to make the command history behave as it does in the Windows intepreter? Specifically, I like the fact that the command history...
17
by: Keith H Duggar | last post by:
Can anyone point me to the origin and history of the dot syntax for accessing structures? Were there languages prior to C that used it? Who invented it? etc.
5
by: Raphael Bauduin | last post by:
Hi, I'm looking at the logging of a database we'll put in production soon. I've seen some posts on this list about history tables, like mentioned in...
0
by: Chris Spencer | last post by:
I'd like to make code.InteractiveConsole function just like the normal Python console. However, when I try to use the arrow keys to recall command history, all I get is...
0
by: mdavila78 | last post by:
Hi there, I was wondering if it's possible to Clear MySQL's History Remotely. Considering that you only have root access to the database but no access to the linux box. I found something in...
25
by: lnatz | last post by:
Hi, I am writing a shell(project). I would like to use readline, ncurses and/or history to search history. I want to write a function that would recognize the KEY_UP and KEY_DOWN,and search the...
0
by: Leonhard Vogt | last post by:
Hello I have subclassed code.InteractiveInterpreter for testing an "interpreter" i have written myself. The interpreter is a function (evaluate) that can raise MyError exceptions. I want...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.