0

In Python package Paramiko, there exists exec_command method in channel.py and client.py, what is the difference between them?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992

1 Answers1

0

The Channel is a low-level API that you should not use in general.

The SSHClient.exec_command calls Channel.exec_command and after that creates stdin/stdout/stderr objects and returns them as 3-touple. With Channel you would have to create these objects yourself (as without them the Channel.exec_command is useless).

See also Paramiko exec_command fails with 'NoneType' object is not iterable.

Additionally, the SSHClient.exec_command has get_pty and environment parameters that trigger Channel.get_pty() and Channel.update_environment respectively.

Check SSHClient.exec_command source code.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992