By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,548 Members | 1,495 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,548 IT Pros & Developers. It's quick & easy.

Catching console output interactively

P: n/a

hi,

I'd like to be able to trap console output as the user writes interactively.
For example if the user press the up or down keys I'd like to be able to
catch this and return the last executed command (a bit like the bash_history
idea). Can anyone point me in the right direction?

thanks for any help,

Rob

Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hello Rob,
I'd like to be able to trap console output as the user writes interactively.
For example if the user press the up or down keys I'd like to be able to
catch this and return the last executed command (a bit like the bash_history
idea). Can anyone point me in the right direction?

Depending on what you'd like to do you can try:
"curses" module (available only on unix like systems)
wxPython
PyGame

HTH.
Miki
Jul 18 '05 #2

P: n/a
Dnia Fri, 16 Apr 2004 13:56:24 +0100, Byrom, R (Rob) pisze:
I'd like to be able to trap console output as the user writes
interactively. For example if the user press the up or down keys I'd
like to be able to catch this and return the last executed command (a
bit like the bash_history idea). Can anyone point me in the right
direction?


This is feature of GNU readline library, available on some Unix and
Unix-like systems. If you want to build something, that resembles Unix
shells, you can use class Cmd from cmd module. This class uses readline if
it is available on host system. I don't know, how it behaves on Windows
and if it uses capabilities of cmd.exe.

--
Jarek Zgoda
http://jpa.berlios.de/

Jul 18 '05 #3

P: n/a
Hello Rob,
I'd like to be able to trap console output as the user writes interactively.
For example if the user press the up or down keys I'd like to be able to
catch this and return the last executed command (a bit like the bash_history
idea). Can anyone point me in the right direction?

Depending on what you'd like to do you can try:
"curses" module (available only on unix like systems)
wxPython
PyGame

HTH.
Miki

Jul 18 '05 #4

P: n/a
"Byrom, R (Rob) " <R.*****@rl.ac.uk> writes:
hi,

I'd like to be able to trap console output as the user writes interactively.
For example if the user press the up or down keys I'd like to be able to
catch this and return the last executed command (a bit like the bash_history
idea). Can anyone point me in the right direction?


What platform?

Cheers,
mwh

--
There's an aura of unholy black magic about CLISP. It works, but
I have no idea how it does it. I suspect there's a goat involved
somewhere. -- Johann Hibschman, comp.lang.scheme
Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.