paramiko exec_command 重定向到一个文件 [英] paramiko exec_command redirect to a file

查看:101
本文介绍了paramiko exec_command 重定向到一个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 paramiko 捕获远程计算机的屏幕截图.我为此使用以下代码

I want to capture the screenshot of a remote computer using paramiko. I am using the following code for that

import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('10.93.80.63', username='root', password='bohica')
ssh.exec_command("xwd -display :0 -silent -root > myscreen.xwd")
ssh.close()

问题是文件 myscreen.xwd 已创建,但大小为 0.能否请您告诉我如何捕获屏幕截图.

The issue is that the file myscreen.xwd is created but the size is 0. Could you please let me know how I can capture the screenshot.

推荐答案

解决了这个问题.问题是 xwd 不可执行且不在标准路径中.通过将 xwd 移动到标准路径解决了这个问题.

Resolved this issue. The issue was that xwd was not executable and was not in the standard path. Resolved this issue by moving xwd to the standard path.

这篇关于paramiko exec_command 重定向到一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆