Interfacing with terminal programs
Cameron Laird
claird at starbase.neosoft.com
Sat May 12 09:04:33 EDT 2001
In article <3afca18b.11011600 at news.earthlink.net>,
Drifty <drifty at bigfoot.com> wrote:
>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.
.
.
.
Can you stomach using Expect? It's a Tcl
extension; I can imagine that's a disin-
centive for you. Although its author,
Don Libes, intended that it be available
in other languages, and a considerable
amount of work has been done on Pyexpect,
the original remains *far* more mature.
It's the right solution for situations
such as yours.
--
Cameron Laird <claird at NeoSoft.com>
Business: http://www.Phaseit.net
Personal: http://starbase.neosoft.com/~claird/home.html
More information about the Python-list
mailing list