Pexpect and a Linux Terminal
asgarde at msn.com
asgarde at msn.com
Mon Dec 24 21:06:41 EST 2007
hello,
I'm new in Python and i would like to use Pexpect to execute a root
command (i want to mount via a Pyhton script a drive)
so that's my script for the moment :
from os import *
import pexpect
import os
cmd1="su -"
cmd2="mount -o loop /home/user/my.iso /mnt/disk"
pwd="mypassword"
child = pexpect.spawn(cmd1)
child.sendline('Mot de passe :')
child.sendline(pwd+"\r\n")
child.sendline(cmd2)
(is a French Terminal so 'Mot de passe' means Password :'
After that i try to execute it, and nothing happened, i know how to
lunch py file via python but i supposed the script don't detect the
prompt Password.
if anyone can help me please :)
Have a nice day !
More information about the Python-list
mailing list