使用Paramiko执行的命令不会产生任何输出

发布于 2025-02-11 05:05:12 字数 383 浏览 1 评论 0原文

当我尝试这样做时,

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

我将获得空输出。


预期的输出是:

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黯然#的苍凉 2025-02-18 05:05:12

如果您在stdout上没有输出,则通常是因为命令无法启动。

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

print(stderr.readlines())

错误通常是“< command>找不到” 。为此,请参见
时,某些Unix命令失败了”


当使用Python paramiko exec_command执行 设备,另请参阅使用paramiko exec_command上的执行命令在设备上不起作用

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文