Calling external program from within python

Grant Edwards grante at
Fri Jul 25 18:50:39 CEST 2008

On 2008-07-25, Diez B. Roggisch <deets at> wrote:

> Because usually if a program *prompts* the user to enter input (and that 
> was what I read from the OP's post), one has to deal with pseudo 
> terminals, not with stdin/out.
>>> If interaction is required, the OP might consider using
>>> pexpect.
>> Pexpect is a good option, but it's just an automation layer on
>> top of the same facilities that subprocess provides.
> AFAIK it's more than that. I'm not an expert on pseudo terminals, but 
> AFAIK setting using module pty isn't possible using subprocess.

You're right.  I forgot that pexect uses a pty.  You could use
a pty with the subprocess module, but it's a hassle to set up.

Grant Edwards                   grante             Yow! The PINK SOCKS were
                                  at               ORIGINALLY from 1952!!
                                 But they went to MARS
                                                   around 1953!!

More information about the Python-list mailing list