Password Prompt

Michael P. Reilly arcege at shore.net
Fri Aug 20 11:13:05 EDT 1999


varner at PENELOPE.CHEM.UIC.EDU wrote:
: Hi,

: I'm writing a Tkinter interface to a program that prompts for a
: password.  I would like to pop a dialog when the program sends the
: prompt, but I'm having a little trouble figuring out how to do that.
: Right now I'm doing

: 	message = os.popen (command, 'r').readlines ()

: but the program sits at this line waiting for a response to the
: password prompt.  Any hints?

I'm not sure what ``command'' is, but it sounds like "/bin/passwd" or
the like.  Most password-prompting programs open the process's
controlling terminal (/dev/tty) and interact that way, this is for
security since stdin could be redirected from anywhere.  You will want
to use something similar to Expect to handle this (one that can handle
pseudo-terminals).  [*shameless self-plug*] One such module is
ExpectPy: http://starship.python.net/crew/arcege/ExpectPy/

  -Arcege





More information about the Python-list mailing list