Bug#534943: reportbug: python / GTK error about being unable to open display when used from console

Jakub Wilk ubanus at users.sf.net
Sun Jun 28 14:40:54 UTC 2009


Sandro,

I think I'd be better to keep this bugreport (or perhaps its clone) 
assigned to reportbug, at least to avoid more duplicate reports.

* Sandro Tosi <morph at debian.org>, 2009-06-28, 15:53:
>> Package: reportbug
>> Version: 4.4
>> Severity: normal
>>
>>
>> I had a bug in another program which forced me to report the bug from single
>> user connsole mode, and received the following error:
>>
>> /usr/lib/pymodules/python2.5/gtk-2.0/gtk/__init__.py:72: GtkWarning: could not open display
>>  warnings.warn(str(e), _gtk.Warning)
>
>this is a bug (if it's a bug) in python-gtk2, hence reassignig it to
>that pacakge.

I'd disagree.

I find it perfectly reasonable that python-gtk2 issues a warning; in 
*most cases* the module has limited usefulness when $DISPLAY is not set to 
a valid value.

Moreover, the issue can be easily fixed in reportbug: by suppressing the 
warning or by checking if $DISPLAY is set before trying to load the 
module. (I could provide a patch if you wish.)

>> This is mainly cosmetic, but reportbug should not rely on there being more
>> than a console mode terminal available.
>We have to know what UIs are available: if there is no DISPLAY, gtk 
>should not issue a warning but raising an exception.

A Python module should not raise exceptions at import time without
a good reason. The solution you propose would break pydoc, for instance.

BTW, I am currenly working around this bug by using the attached 
wrapper.

-- 
Jakub Wilk
-------------- next part --------------
#!/bin/sh
tmpdir=`mktemp -t -d` || exit 1
touch "$tmpdir/gtk.py"
PYTHONPATH="$tmpdir" /usr/bin/reportbug "$@"
rm -Rf "$tmpdir"


More information about the pkg-gnome-maintainers mailing list