Automatically filling in answers to interactive shell command questions

Trent Mick trentm at ActiveState.com
Mon Jul 21 19:04:38 EDT 2003


Check out pexpect, a Python version of the popular Tcl-land Expect
program:
    http://pexpect.sourceforge.net/

I haven't used it but I get the feeling that pexpect is Un*x-only if
that affects you at all.

Trent

[Ted Weatherly wrote]
> Is it possible to use python to automatically fill in the answers to
> interactive shell command questions?  For example, I am using a shell
> command addperson that behaves as follows:
> 
>   > addperson
>   First Name: Ted
>   Birthday: 12/08/1977
>   Height: 6'0"
>   Location: San Francisco, CA
>   > 
> 
> I am prompted for "First Name: " and I enter "Ted".  I am prompted for
> "Birthday: " and I enter "12/08/1977".  Imagine doing this for 100
> people or more...it gets tiresome.
> 
> Assuming I can't change the addperson command to read data from a
> file, is there any way to use python to fill in the data for the
> expected questions?  Perhaps a different language would be better?
> 
> -Ted
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
Trent Mick
TrentM at ActiveState.com





More information about the Python-list mailing list