Catching console output interactively

Jarek Zgoda jzgoda at gazeta.usun.pl
Sun Apr 18 03:54:19 EDT 2004


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/




More information about the Python-list mailing list