【问题标题】:Command executed with Paramiko does not produce any output使用 Paramiko 执行的命令不会产生任何输出
【发布时间】:2022-01-10 17:35:07
【问题描述】:

当我尝试做时

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

我得到一个空输出。


预期的输出是:

===================== GLASS version details =====================
 GLASS version : 1.2.3
=================================================================

【问题讨论】:

    标签: python ssh stdout paramiko


    【解决方案1】:

    如果stdout 没有输出,通常是因为命令启动失败。

    阅读stderr 以检查是否有任何错误。

    print(stderr.readlines())
    

    错误常常是 not found”。为此,请参阅
    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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-10-07
      • 1970-01-01
      • 2018-01-28
      • 1970-01-01
      相关资源
      最近更新 更多