MR.i
MR.i

Reputation: 125

Command executed with Paramiko does not produce any output

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
=================================================================

Upvotes: 2

Views: 5907

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202534

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.

Upvotes: 3

Related Questions