Re: [dev] [wmii] Python monitor function failure

From: Thomas Dahms <t_AT_skwillt.de>
Date: Wed, 23 Jun 2010 15:18:19 +0200

On 06/23/2010 02:58 PM, m g wrote:
> You can use the codecs module. Something like:
>
> import codecs
>
> @defmonitor
> def anowplaying(self):
> try:
> np = codecs.open('/tmp/shell-fm', 'r', 'utf-8').read()
> except:
> np = ''
> return wmii.cache['normcolors'], np

Thanks, this does work.

> Though im not so sure having a blanket except is so useful.

I have ' ', not ''. As I understand, empty strings are not written by
the internal file interface of wmii, so I use a single whitespace when
the player has stopped, otherwise the last nonempty string will stay in
the status line. This maybe a dumb solution, though.

-- 
Thomas Dahms
Received on Wed Jun 23 2010 - 13:18:19 UTC

This archive was generated by hypermail 2.2.0 : Wed Jun 23 2010 - 13:24:01 UTC