Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'automate': 0.07; '"if': 0.09; 'cursor': 0.09; 'in-house': 0.09; 'pointers': 0.09; 'subject:using': 0.09; 'python': 0.11; 'sections': 0.14; 'aptitude': 0.16; 'carriage': 0.16; 'emacs,': 0.16; 'line).': 0.16; 'overwriting': 0.16; 'subject:program': 0.16; 'library': 0.18; 'trying': 0.19; 'seems': 0.21; 'this?': 0.23; 'oriented': 0.24; 'cheers,': 0.24; 'login': 0.25; 'subject:/': 0.26; 'appreciated.': 0.29; 'external': 0.29; 'message- id:@mail.gmail.com': 0.30; 'that.': 0.31; 'towards': 0.31; 'fine,': 0.31; 'run': 0.32; 'linux': 0.33; 'screen': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'ubuntu': 0.36; 'subject:?': 0.36; 'application': 0.37; 'jason': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'new': 0.61; 'complete': 0.62; 'making': 0.63; 'kind': 0.63; 'more': 0.64; 'movement': 0.65; 'prompt': 0.68; '(probably': 0.84; 'old,': 0.85 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=XJBX6UP45519zO2mabHgt+5uW0sZEu/av//bYHiKWfI=; b=aH7DPmJ+8/cvYDl1xjeLDem18VV1X5yIkA+HF3/yuiPWCAM1+NNLdK9CKl442Si+f5 BqI6U/0LA7i8Y8nGF2tEpPeINHXplAay3YfW2falrt78cDL1exoPJMxPN6CVByUgd/f/ bM6vKeFtIwhM7wIKnnLf71xaKlfzE9DM++aGAEJtgR6M6ZCPaRih2oWG5uN6z5t6QhmA HakTvOurm3ptJQF2cQwy1LO0Jv3OtXvsK6FAekvUcUk+liA0uWH7WNoc8aJRONPb8YEx QbLNM4qvS4vKWJwtXvEuz+0VTgVRZORKgz3/1L2vAVQ9rtI3nnJqWSHgyfvTo+INmAHy crBg== MIME-Version: 1.0 X-Received: by 10.55.31.83 with SMTP id f80mr58235757qkf.57.1426330236024; Sat, 14 Mar 2015 03:50:36 -0700 (PDT) Date: Sat, 14 Mar 2015 21:50:35 +1100 Subject: Module/lib for controlling a terminal program using redrawing? From: Jason Heeris To: python-list@python.org Content-Type: multipart/alternative; boundary=001a1147b55c0cfff205113d63d4 X-Mailman-Approved-At: Sat, 14 Mar 2015 12:11:30 +0100 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 61 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1426331491 news.xs4all.nl 2851 [2001:888:2000:d::a6]:56736 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:87418 --001a1147b55c0cfff205113d63d4 Content-Type: text/plain; charset=UTF-8 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 --001a1147b55c0cfff205113d63d4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I am trying to automate the use of some old, in-house= terminal-based programs that use screen redrawing for their interface. Thi= s 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).
<= br>
Is there a module/library that can help me with this?

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

This automa= tion 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 redrawin= g activity so I don't have to even know if the application has, eg. use= d a carriage return or some other kind of cursor movement? Is there a way t= o just ask "if this were to be run in an ANSI terminal, what would be = in each cell?"

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

Any pointers = appreciated.

Cheers,
Jason
--001a1147b55c0cfff205113d63d4--