[Tutor] Popen and Prompting

Faulconer, Steven M. STEVEN.M.FAULCONER at saic.com
Wed Aug 31 20:16:02 CEST 2005


I thought about that, but it would potentially cause other conflicts. I
think our final plan is to edit the code to die on error cases instead of
prompting. However, if anyone knows of a way of handling this, I'd love to
know for future use. Thanks for the response.


-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On Behalf
Of John Fouhy
Sent: Tuesday, August 30, 2005 7:03 PM
To: tutor at python.org
Subject: Re: [Tutor] Popen and Prompting

On 31/08/05, Faulconer, Steven M. <STEVEN.M.FAULCONER at saic.com> wrote:
> My question for all of you python people; how can I handle programs that
> need input from the command line. I thought about using something like
> pexpect, but the input requests are fairly variable, and may not show up
> all. Also, I need to tie this in with the Tkinter GUI as well. The
> we are running are written in C, and we have no way of changing that (it's
> in-house software, but the API we have to use does not talk to Python). 

Could you kludge it?

eg, change the C programs so that, every time they ask for user input,
they include in the prompt a certain unusual string.  Then, any time
your GUI detects this string in the program output, it can pop up a
dialog box asking for user input.

(just a suggestion ... I don't know the best way of dealing with this)

Tutor maillist  -  Tutor at python.org

More information about the Tutor mailing list