Re: [Bug 660181] Re: dstat lost color support in ubuntu 10.10
On Thu, 14 Oct 2010, dag wrote: On Thu, 14 Oct 2010, Maxime Ritter wrote: dag wrote: 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 ? TERM=dumb It's very easy to reproduce : take a Xubuntu i386 10.10 CD, and install it with an unplugged internet connection (or without the package updates, as the fix for Bug #621927 has been released, but didn't catch my mirror). Reboot, run the xfce terminal (default terminal in xubuntu), apt-get install dstat, then run dstat Apparently the wrong TERM is not the cause for this. Trying to reproduce this on my CentOS system I get: [...@moria dstat]$ TERM=dumb ./dstat -ta system total-cpu-usage -dsk/total- -net/total- ---paging-- ---system-- time |usr sys idl wai hiq siq| read writ| recv send| in out | int csw 14-10 09:57:45| 6 1 92 1 0 0| 29k 50k| 0 0 |4924B 5696B|2408 7228 14-10 09:57:46| 2 0 98 0 0 0| 0 0 | 262B 112B| 0 0 | 324 685 So the wrong TERM is not the cause here. Could you remove the try/except statement around that block and send me the exception you get ? Ok, I had some time to look at this and on CentOS 'dumb' is in fact a real termcap entry that does not support colors. But if I instead use something fake, I get this: [...@moria dstat]$ TERM=dag dstat -ta Color support is disabled, python-curses is not installed. system total-cpu-usage -dsk/total- -net/total- ---paging-- ---system-- time |usr sys idl wai hiq siq| read writ| recv send| in out | int csw 14-10 19:39:25| 2 0 98 0 0 0| 77k 70k| 0 0 | 0 0 | 318 637 14-10 19:39:26| 1 1 99 0 0 0| 0 0 | 0 0 | 0 0 | 547 1389 So I have now fixed this to display: [...@moria dstat]$ TERM=dag ./dstat -ta Color support is disabled as terminal (TERM=dag) does not support colors. system total-cpu-usage -dsk/total- -net/total- ---paging-- ---system-- time |usr sys idl wai hiq siq| read writ| recv send| in out | int csw 14-10 19:40:06| 2 0 98 0 0 0| 77k 70k| 0 0 | 0 0 | 318 638 14-10 19:40:07| 1 1 99 0 0 0| 016k| 0 0 | 0 0 | 515 1210 The fix was quite simple: 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 ImportError: print sys.stderr, 'Color support is disabled as python-curses is not installed.' return False except: print sys.stderr, 'Color support is disabled as terminal (TERM=%s) does not support colors.' % os.getenv('TERM') return False return color Thanks for reporting ! -- -- dag wieers, d...@wieers.com, http://dag.wieers.com/ -- [Any errors in spelling, tact or fact are transmission errors] -- dstat lost color support in ubuntu 10.10 https://bugs.launchpad.net/bugs/660181 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
Re: [Bug 660181] Re: dstat lost color support in ubuntu 10.10
On Thu, 14 Oct 2010, Maxime Ritter wrote: dag wrote: 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 ? TERM=dumb It's very easy to reproduce : take a Xubuntu i386 10.10 CD, and install it with an unplugged internet connection (or without the package updates, as the fix for Bug #621927 has been released, but didn't catch my mirror). Reboot, run the xfce terminal (default terminal in xubuntu), apt-get install dstat, then run dstat Apparently the wrong TERM is not the cause for this. Trying to reproduce this on my CentOS system I get: [...@moria dstat]$ TERM=dumb ./dstat -ta system total-cpu-usage -dsk/total- -net/total- ---paging-- ---system-- time |usr sys idl wai hiq siq| read writ| recv send| in out | int csw 14-10 09:57:45| 6 1 92 1 0 0| 29k 50k| 0 0 |4924B 5696B|2408 7228 14-10 09:57:46| 2 0 98 0 0 0| 0 0 | 262B 112B| 0 0 | 324 685 So the wrong TERM is not the cause here. Could you remove the try/except statement around that block and send me the exception you get ? Also, what version of Dstat is this ? 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... I don't know Python, but I can some suggest 2 fixes : 1. you can change the message to Color support is disabled, python- curses is not installed, not working, or TERM $env{'TERM'} not recognized. 2. Something like that (like that, as I said, I don't the Python langage) : def gettermcolor(color=True): Return whether the system can use colors or not if color and sys.stdout.isatty(): try: import curses except: print sys.stderr, 'Color support is disabled, python-curses is not installed.' return False try: curses.setupterm() if curses.tigetnum('colors') 0: return False except: print sys.stderr, 'Color support is disabled; TERM=$ENV{'TERM'} not recognized, or python-curses is not working.' return False return color Yes, that's what I would expect, although without a proven root-cause or reproducing the problem I prefer not to change it yet. -- -- dag wieers, d...@wieers.com, http://dag.wieers.com/ -- [Any errors in spelling, tact or fact are transmission errors] -- dstat lost color support in ubuntu 10.10 https://bugs.launchpad.net/bugs/660181 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
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, d...@wieers.com, http://dag.wieers.com/ -- [Any errors in spelling, tact or fact are transmission errors] -- dstat lost color support in ubuntu 10.10 https://bugs.launchpad.net/bugs/660181 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs