我正在尝试通过python脚本提供"sudo su - appluser“帐户的密码
import pexpect
chld = pexpect.spawn('sudo su - appluser')
chld.expect('[sudo] password for rajesh:')
chld.sendline('XXX')
#print chld.before但是我得到了这个错误
Traceback (most recent call last):
File "test3.py", line 3, in <module>
child = pexpect.spawn('sudo su - appluser')
File "/users/rajesh/pexpect/__init__.py", line 511, in __init__
self._spawn(command, args)
File "/users/rajesh/pexpect/__init__.py", line 616, in _spawn
'executable: %s.' % self.command)
pexpect.ExceptionPexpect: The command was not found or was not executable: sudo.你能检查一下这个并在这里纠正我吗?
发布于 2015-11-06 16:42:23
尝试使用sudo命令的绝对路径(/usr/bin/sudo)。
https://stackoverflow.com/questions/28973129
复制相似问题