当我尝试做
stdin, stdout, stderr = client1.exec_command('glass-version')
print stdout.readlines()
我得到一个空输出。预期的输出是:
===================== GLASS version details =====================
GLASS version : 1.2.3
=================================================================
最佳答案
如果在 stdout
上没有输出,通常是因为命令启动失败。
阅读 stderr
检查任何错误。
print(stderr.readlines())
通常错误是“
Some Unix commands fail with "<command> not found", when executed using Python Paramiko exec_command
如果您要连接到设备,另请参阅 Executing command using Paramiko exec_command on device is not working .
关于python - 使用 Paramiko 执行的命令不会产生任何输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70229745/