Interfacing with terminal programs
Drifty
drifty at bigfoot.com
Tue May 15 04:21:50 EDT 2001
I decided to give your suggestion a go, Donn, and I had an unexpecting
surprise. The command that we are running is 'sudo nispassword
<username>'. I decided to try popen2 to get the file objects and then
use your suggestion of the fd to read from it. But when I read from
it the prompt output straight to the screen when all I was doing was
write the output to a variable. I have no clue why it output to the
screen, but it did.
I can't try a pty either since they are apparently broken on our
current install. I am hoping that when I install Python 2.1 that it
will fix that and I can see what is causing the problem. I guess the
least I can end up doing is running the various commands in sequence
and automate the entry in the log. Thanks for the help.
-Brett Cannon
On 14 May 2001 03:54:59 GMT, Donn Cave <donn at oz.net> wrote:
>If you use the file object's fileno() method to get the file descriptor,
>you can forget about the file object and use os.read(fd, size) to
>read what's in the pipe.
>
> Donn Cave, donn at oz.net
More information about the Python-list
mailing list