> Would you mind perhaps show an example running an interactive  
> command like su and show how to send input to the commands waiting  
> propmts?

If you're doing that then you *really* want to be using the pexpect
module.

cmd = pexpect.spawn('su - SOMEINTERACTIVECOMMAND')
cmd.expect('# ')   # the prompt
cmd.sendline('A COMMAND')
cmd.expect('# ')   # wait for the prompt again
output = cmd.before  # the stuff before the prompt
cmd.sendline('exit')
cmd.close()


- Jeff Younker - [EMAIL PROTECTED] -


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to