Paramiko X11 mode with python programming

心不动则不痛 提交于 2019-12-08 03:42:27

I needed to use paramiko to run the GUI in another X11 window and found this post. I think you may need to add few lines to make it work. It's all about the handler parameter.

Here, assign a function for incoming X11 connections.

chan.request_x11 (handler=testFunc())  

And write a simple one.

import commands
def testFunc():
    cmd = "xterm"
    result = commands.getoutput(cmd)

It should pop out a new window after that. At least it works for me.

Gary van der Merwe

Reading the paramiko code, I realized that paramiko only implements a way to establish an x11 channel. It does not connect the channel to the local x11 display. That is left to you.

Please see this answer for a working example of how to do this: https://stackoverflow.com/a/12903844/72911

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!