Interfacing with terminal programs

Drifty drifty at bigfoot.com
Fri May 11 22:44:42 EDT 2001


I volunteer at the Open Computing Facility at UC Berkeley
(www.ocf.berkeley.edu) and I am trying to help automate the changing
of user's passwords.  We currently have to run two separate
terminal-based programs to change a password and then document the
change in a log file.  The problem is that I can't figure out how to
get Python to interface with the terminal program without deadlocking.
I tried using popen2 but it deadlocks when I read from the output fd.
I would get away with just using the input fd if I could, but I have
to make sure the staffer entered their password properly and so I have
to check to see if it prompted for the password of the staffer again
or  is ready to take the new password for the user.  I assume the
deadlock is caused because of the prompt from the terminal program
isn't letting the output fd know it reached the end of the read.

Any suggestions?  This has to run on Solaris, so using something like
pty is obviously iffy.  I am hoping that solving this will allow me to
do more Python scripting for our lab and thus try to get more staffers
to stop thinking that Perl is the be-all-end-all scripting languages.
Thanks for any help given.

-Brett Cannon
Open Computing Facility, UC Berkeley



More information about the Python-list mailing list