Running gtg when X is unavailable produces ugly error message

Bug #519202 reported by Bryce Harrington on 2010-02-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Getting Things GNOME!
Low
Bryce Harrington

Bug Description

gtg should bail out early if X is unavailable. Instead, it appears to continue on trying and generates a rather ugly error message:

bryce@salisbury:~$ gtg
X11 connection rejected because of wrong authentication.
/usr/lib/pymodules/python2.6/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
  warnings.warn(str(e), _gtk.Warning)
/usr/local/lib/python2.6/dist-packages/GTG/taskbrowser/browser.py:171: GtkWarning: gtk_icon_theme_get_for_screen: assertion `GDK_IS_SCREEN (screen)' failed
  gtk.icon_theme_get_default().prepend_search_path(i)
Traceback (most recent call last):
  File "/usr/local/bin/gtg", line 40, in <module>
    sys.exit(GTG.gtg.main(options, args))
  File "/usr/local/lib/python2.6/dist-packages/GTG/gtg.py", line 120, in main
    tb = TaskBrowser(req, config, logger=logger)
  File "/usr/local/lib/python2.6/dist-packages/GTG/taskbrowser/browser.py", line 106, in __init__
    self._init_icon_theme()
  File "/usr/local/lib/python2.6/dist-packages/GTG/taskbrowser/browser.py", line 171, in _init_icon_theme
    gtk.icon_theme_get_default().prepend_search_path(i)
AttributeError: 'NoneType' object has no attribute 'prepend_search_path'

Related branches

Luca Invernizzi (invernizzi) wrote :

How to detect if X is unavailable? an easy way is look at the environment variables (which would make this a bug marked "love"), but having DISPLAY set does not mean that X is really running.
But then, are we going to care if someone is so evil to set DISPLAY manually?

Changed in gtg:
status: New → Triaged
importance: Undecided → Low
milestone: none → 0.3
Luca Invernizzi (invernizzi) wrote :

Just thought about it. Shouldn't this be handled directly from the gtk library (throwing a gigantic exception)?

On Tue, Feb 9, 2010 at 10:20 AM, Luca Invernizzi <email address hidden> wrote:
> Just thought about it. Shouldn't this be handled directly from the gtk
> library (throwing a gigantic exception)?

I'm actually amazed the gtk main loop doesn't exit with an exception
if there's no available display... I don't quite know how to test for
it.

> --
> Running gtg when X is unavailable produces ugly error message
> https://bugs.launchpad.net/bugs/519202
> You received this bug notification because you are a member of Gtg
> contributors, which is subscribed to Getting Things GNOME!.
>

--
Bertrand Rousseau

Bryce Harrington (bryce) wrote :

Checking DISPLAY is insufficient (I tried).

  bryce@salisbury:~/src/gtg/gtg-nox$ echo $DISPLAY
  localhost:11.0

Neither gtk nor pygtk throws an exception in this case, so can't solve it that way.

Fortunately I found a simple solution, to just try running xset and check the error on that.

Branch with my proposed fix is at https://code.launchpad.net/~bryceharrington/gtg/gtg-nox

Luca Invernizzi (invernizzi) wrote :

Merged.
The ubuntu xorg maintainer says "xset is provided by x11-xserver-utils, which is part of the core seed for ubuntu's X.org.
 similarly on other linux distros", so it will not be a dependency.

Changed in gtg:
status: Triaged → Fix Committed
assignee: nobody → Bryce Harrington (bryceharrington)
Changed in gtg:
milestone: 0.3 → 0.2.2
Changed in gtg:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers