简体   繁体   English

没有X11的DBus Finch / Pidgin

[英]DBus Finch/Pidgin without X11

I want to do some Python scripting on my server where I can communicate with finch (A console interface of pidgin , with the interface looking like links2 ) through the DBus Python library to send messages or check for buddy online status. 我想在服务器上做一些Python脚本,通过links2 Python库与finchpidgin的控制台接口,接口看起来像links2 )进行通信,以发送消息或检查好友的在线状态。

This works if you do it in X. Run finch in an X terminal and run the Python script in another terminal with no errors/exceptions. 如果您在X中执行此操作,则将起作用 。在X终端中运行finch ,然后在另一个终端中运行Python脚本,而不会出现错误/异常。

But if you do it without X , you have to run finch in TTY1 (ctrl+alt+f1) and the python script in TTY2 (ctrl+alt+f2) but the python script will fail . 但是,如果不使用X进行操作 ,则必须在TTY1(ctrl + alt + f1)中运行finch ,在TTY2(ctrl + alt + f2)中运行python脚本,但python脚本将失败

The following is the first few lines of the script: 以下是脚本的前几行:

import dbus
bus = dbus.SessionBus() # gives EXCEPTION error
obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
...

The EXCEPTION error is: EXCEPTION错误为:

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ExecFailed: dbus-launch failed to autolaunch D-Bus session: Autolaunch error: X11 initialization failed.`

I read somewhere that maybe you need to run finch and the script both in the same TTY. 我读过某个地方的文章,也许您需要在同一TTY中运行finch和脚本。 However I am unable to test that properly because it is not like running cd on one line and ls on the next line. 但是我无法正确测试它,因为它不像在一行上运行cd并在下一行运行ls You type finch , it runs, and you can't type any other commands anymore, like links2 . 您键入finch ,它就会运行,并且您不能再键入其他命令,例如links2 I tried running finch & instead but that seems to pause finch , and running the script also gives the same error. 我尝试运行finch &但似乎暂停了finch ,并且运行脚本也给出了相同的错误。

Solution? 解? Thanks. 谢谢。

Install screen 安装screen

  1. dbus-launch screen
  2. finch
  3. ctrl+ac CTRL + AC
  4. python myscript

I think finch needs some display. 我认为雀科需要一些展示。 To launch it on the server try to use xvfb-run : http://en.wikipedia.org/wiki/Xvfb 要在服务器上启动它,请尝试使用xvfb-runhttp : //en.wikipedia.org/wiki/Xvfb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM