Calling external program from within python

Diez B. Roggisch deets at
Fri Jul 25 16:44:06 CEST 2008

Grant Edwards schrieb:
> On 2008-07-25, Diez B. Roggisch <deets at> wrote:
>>> There are probably many ways to do this. I would recommend
>>> checking out the subprocess module and see if it does what you
>>> want.
>> This will only work if the program can be fully controlled by 
>> commandline arguments.
> Why do you say that?   You can interact with programs via
> stdin/stdout using the subprocess module.

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.


More information about the Python-list mailing list