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
=================================================================
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0