Comment 2 for bug 660181

Revision history for this message
dag (dag-wieers) wrote : Re: [Bug 660181] Re: dstat lost color support in ubuntu 10.10

On Wed, 13 Oct 2010, Maxime Ritter wrote:

> Ok, in fact it is working ; the TERM environment variable was wrongly
> set up.
>
> So the real bug are :
> - why does dstat complain about missing python-curses instead of a wrong TERM environnement ? (not an ubuntu bug)
> - why is the default xubuntu terminal application reporting a wrong TERM ? (Bug #659023)
>
> So we can close this bug.
>
> ** Changed in: dstat (Ubuntu)
> Status: New => Invalid

Quite easy, the block that tests for a functional curses apparently fails
on Ubuntu 10.10. What TERM was set in this case so I can reproduce the
problem and see if another error message makes any sense in this case ?

----
def gettermcolor(color=True):
     "Return whether the system can use colors or not"
     if color and sys.stdout.isatty():
         try:
             import curses
             curses.setupterm()
             if curses.tigetnum('colors') < 0:
                 return False
         except:
             print >>sys.stderr, 'Color support is disabled, python-curses is not installed.'
             return False
     return color
----

If you have a better implementation or any suggestion, feel free to
provide that information rather than pointing in a general direction...

Thanks in advance,
--
-- dag wieers, <email address hidden>, http://dag.wieers.com/ --
[Any errors in spelling, tact or fact are transmission errors]