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

From: m g <miles.groman_AT_gmail.com>
Date: Wed, 23 Jun 2010 08:58:24 -0400

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

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

Also, this code is just an example, I havent actually typed it into an
interpreter.
Received on Wed Jun 23 2010 - 12:58:24 UTC

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