title: DBus Finch/Pidgin without X11
body: <p>I want to do some Python scripting on my server where I can communicate with <code>finch</code> (A console interface of <code>pidgin</code>, with the interface looking like <code>links2</code>) through the DBus Python library to send messages or check for buddy online status.</p>
  
  <p>This <strong>works</strong> if you do it in X. Run <code>finch</code> in an X terminal and run the Python script in another terminal with no errors/exceptions.</p>
  
  <p>But if you do it <strong>without X</strong>, you have to run <code>finch</code> in TTY1 (ctrl+alt+f1) and the python script in TTY2 (ctrl+alt+f2) but the python script will <strong>fail</strong>. </p>
  
  <p>The following is the first few lines of the script:</p>
  
  <pre><code>import dbus
  bus = dbus.SessionBus() # gives EXCEPTION error
  obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
  ...
  </code></pre>
  
  <p>The EXCEPTION error is:</p>
  
  <pre><code>dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ExecFailed: dbus-launch failed to autolaunch D-Bus session: Autolaunch error: X11 initialization failed.`
  </code></pre>
  
  <p>I read somewhere that maybe you need to run <code>finch</code> and the script both in the same TTY. However I am unable to test that properly because it is not like running <code>cd</code> on one line and <code>ls</code> on the next line. You type <code>finch</code> , it runs, and you can't type any other commands anymore, like <code>links2</code>. I tried running <code>finch &amp;</code> instead but that seems to pause <code>finch</code>, and running the script also gives the same error.</p>
  
  <p>Solution? Thanks.</p>