我没有设法使用通过其ssh X11管理功能的Paramiko python模块。
我想使用它,就像我使用ssh -X选项一样。
我已经尝试了几种解决方案,但没有在我的系统上工作。用python编程的Paramiko X11模式
这里是我试过的代码:
client = paramiko.SSHClient()
client.set_missing_host_key_policy(AutoAddPolicy())
client.connect(machineName, username=xxx, password=xxx)
t = client.get_transport()
chan = t.open_session()
chan.request_x11()
chan.set_combine_stderr (True)
chan.exec_command (xxxxx) # the command that should display a X11 window
bufsize = -1
stdin = chan.makefile('wb', bufsize)
stdout = chan.makefile('rb', bufsize)
stderr = chan.makefile_stderr('rb', bufsize)
for line in stdout:
print '... ' + line.strip('\n')
client.close()
我也试过(而不是exec_command):
chan.get_pty("vt100", 80, 50)
chan.invoke_shell()
chan.send(xxxxx) # the command that should display a X11 window
不幸的是,我的应用程序冻结在通常出现X11窗口的时刻。备注:如果我启动一个没有显示X11窗口的命令,它可以很好地工作。
感谢你的帮助,
问候
是您的显示环境变量对远程shell设置?如果是这样,它是什么? – kevpie 2010-12-15 10:48:11
它设置为localhost:10.0 – oaimac 2010-12-15 15:24:16