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

Reply via email to