2

When I try to do

stdin, stdout, stderr = client1.exec_command('glass-version')
print stdout.readlines()

I am getting an empty output.


An expected output is:

===================== GLASS version details =====================
 GLASS version : 1.2.3
=================================================================
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
MR.i
  • 115
  • 1
  • 7

1 Answers1

3

If you get no output on stdout, it is usually because the command fails to start.

Read stderr to check for any errors.

print(stderr.readlines())

Quite often the error is "<command> not found". For that see
Some Unix commands fail with "<command> not found", when executed using Python Paramiko exec_command


If you are connecting to a device, see also Executing command using Paramiko exec_command on device is not working.

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