> I have one solution for this problem: > > def execute(self, command): > """Execute the given commands on a remote machine.""" > channel = self._transport.open_session() > channel.exec_command(command) > if command.startswith("sudo"): > time.sleep(1) > channel.send(self.password + "\n") > time.sleep(1) > channel.send(self.password + "\n") > output = channel.makefile('rb', -1).readlines() > if not output: > output = channel.makefile_stderr('rb', -1).readlines() > channel.close() > return output > > it's really works, but have one problem, when the sudo version is newest > or equal than 1.7.1, this doesn't works, i paste the output when we use > the last version of sudo. > > sudo: no tty present and no askpass program specified >
Maybe we should go back to invoke_shell() call, not the open_session() one, isn't it? -- >: ~
_______________________________________________ paramiko mailing list paramiko@lag.net http://www.lag.net/cgi-bin/mailman/listinfo/paramiko