[Tutor] Popen and Prompting

Faulconer, Steven M. STEVEN.M.FAULCONER at saic.com
Wed Aug 31 21:34:19 CEST 2005


Danny,

Thanks for the response. We looked at using pexpect (I'm a UNIX guy at
heart), but we have variable command prompts, that may or may not show up,
with this program, so expect/pexpect would be difficult. John's suggestion
was to add some sort of unique ID as a good idea, but won't work in this
situation. I guess in the end, doing something with pexpect would be the way
to go if I needed to. This issue has been resolved in another way (per my
last message to the list).

Thanks again for the response,
Steven

-----Original Message-----
From: dyoo at hkn.eecs.berkeley.edu [mailto:dyoo at hkn.eecs.berkeley.edu] 
Sent: Wednesday, August 31, 2005 3:06 PM
To: Faulconer, Steven M.
Cc: tutor at python.org
Subject: Re: [Tutor] Popen and Prompting



On Tue, 30 Aug 2005, Faulconer, Steven M. wrote:

> Been digging through the web and the archives for the tutor list and
> can't seem to locate an answer to my question. It is probably out there,
> but my searching skills are failing me. I recently wrote a GUI for
> several command line programs using Tkinter. Everything is working quite
> well, until I ran into one program that actually prompts for some input.

Hi Steven,

This is a common problem.  The Unix folks have traditionally used a
program called "Expect" to automate talking with interactive external
processes. There's a Python equivalent to Expect: take a look at the
'pexpect' module.  Here you go:

    http://pexpect.sourceforge.net/

The documentation on that page has a few examples that should help you get
started.  Best of wishes to you!


More information about the Tutor mailing list