issue with pexpect
Daniel
5960761 at gmail.com
Wed Oct 5 05:02:44 EDT 2011
Hello,
For about week i am experiencing a problem with pexpect that's why i
hope you can help me :).
Following is my code which tries to remove some files from the root dir
and the code works on linux debian and freebsd but with no success on
linux fedora .. any idea why this happen only in fedora ?
#!/usr/bin/env python
from __future__ import print_function
import sys
import pexpect
import time
spa=pexpect.spawn('su root')
spa.expect('.*')
print(spa.after)
spa.sendline('abc')
spa.expect('.*')
print(spa.after)
spa.sendline('rm -rf /root/py/pe*')
spa.expect('.*')
print(spa.after)
spa.close()
this is the output in Fedora linux it looks that the script can't
authenticate as root
python]$ ./sk64.py
Password:
rm -rf /root/py/pe*
i appreciate any help thanks in advance
More information about the Python-list
mailing list