Module/lib for controlling a terminal program using redrawing?

Jason Heeris jason.heeris at gmail.com
Sat Mar 14 06:50:35 EDT 2015


I am trying to automate the use of some old, in-house terminal-based
programs that use screen redrawing for their interface. This includes
single line redrawing (eg. using '\r' and overwriting), complete screen
clearing, and fine-grained cursor movement and overwriting (probably not
all in the same program at the same time though).

Is there a module/library that can help me with this?

I know of pexpect, but that seems more oriented towards line-by-line
prompts that don't involve redraws (eg. login prompt, then password prompt
on a new line). Think instead of trying to automate applications like
emacs, aptitude or even nethack that redraw sections of the screen without
making the terminal scroll.

This automation requires more than just sending a set of keystrokes, but
also reading what is displayed on screen and making decisions based up on
that.

Is there a library that can abstract the received redrawing activity so I
don't have to even know if the application has, eg. used a carriage return
or some other kind of cursor movement? Is there a way to just ask "if this
were to be run in an ANSI terminal, what would be in each cell?"

Python 2 or 3 are both fine, external packages are fine, but it has to work
on Linux (eg. Ubuntu 14.04 or later, Debian Wheezy or later).

Any pointers appreciated.

Cheers,
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150314/3a08e069/attachment.html>


More information about the Python-list mailing list