Redirecting stdout and stdin
Matthew Thorley
ruach at chpc.utah.edu
Thu Mar 4 14:50:32 EST 2004
I am working on a script that calls a program ssh in this case. The
script needs to be non-interactive so I need python to comunicate with
ssh. I am having difficult time opening a pipe to the program and
reading and writing output to it. I tried using popen something like:
ssh = popen('ssh user at host')
if ssh[1].readline = 'something':
ssh[0].write('password')
Etc...
But everytime I run the thing stdout still shows up on the command line
and I get propmted to enter the password interactively.
Any thoughts ?
thanks much
-matthew
More information about the Python-list
mailing list