Interacting With Another Script

Grant Edwards invalid at invalid.invalid
Wed Mar 10 11:44:29 EST 2010


On 2010-03-10, Chris Rebert <clp2 at rebertia.com> wrote:
> On Wed, Mar 10, 2010 at 8:34 AM, Victor Subervi <victorsubervi at gmail.com> wrote:
>
>> Yeah, that was my idea. But how does the program know when it's being
>> prompted to enter data? That's my question ;)
>
> There's no magical "prompt time".

That depends on the program.  Some programs that prompt for input
(particulary username/password) flush stdin before displaying each
prompt.  I'm not saying the program in question does that...

> The process's stdin's openness to writing is not conditional.

That doesn't mean that data written prior to the prompt won't be
ignore.

> Just send it all the input at once with the proper newlines in place
> and it should work just fine assuming the user input was valid
> (barring vpopmail using some fancy terminal input malarkey like
> curses).

It's worth trying, but there's a slight chance it won't work.

-- 
Grant Edwards               grant.b.edwards        Yow! But they went to MARS
                                  at               around 1953!!
                              gmail.com            



More information about the Python-list mailing list