issue with pexpect

Daniel 5960761 at gmail.com
Wed Oct 5 11:05:50 EDT 2011


Okey i figure it out how to do the job in fedora
i added slight delay before sending each command
either by the delaybeforesend attribute or by the time module
;)
cheers
On Wed, 2011年10月05日 at 14:47 +0200, Nizamov Shawkat wrote:
> 2011年10月5日 Daniel <5960761 at gmail.com>:
> > 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
> >
>> Hi!
>> The problem may be that root user is disabled. This was introduced in
> Ubuntu long ago and I believe that later this was also accepted in
> Fedora. That means that you simply can not "su" to root, no matter
> what password you supply. This is the way how your OS operates and is
> not connected in any way to python or pexpect. Therefore, either use
> sudo (generally recommended) or enable root user (insecure!).
>> Hope it helps,
> S.Nizamov



More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /