Py3status: mpd_status (UnicodeDecodeError) i3status.py line 282, with Python 2 and unicode in track names

Created on 14 Sep 2016  路  11Comments  路  Source: ultrabug/py3status

I just tried installing py3status and on starting it (by i3 or through shell) I get an error saying

py3status: Setup error (UnicodeDecodeError) i3status.py line 282. Please try to fix this and reload i3wm.

screenshot: http://i.imgur.com/ysLDRAJ.png

$ py3status --version
py3status version 3.0 (python 3.5.2)

bar config from i3 config file

bar {
    font pango: System San Francisco Display, FontAwesome 10
    status_command py3status
    #tray_output primary
    colors {
        background $bg-color
        separator #757575
        #                  border             background         text
        focused_workspace  $bg-color          $bg-color          $text-color
        inactive_workspace $inactive-bg-color $inactive-bg-color $inactive-text-color
        urgent_workspace   $urgent-bg-color   $urgent-bg-color   $text-color
    }
}
bug

Most helpful comment

this has been fixed in #506

All 11 comments

Thanks for reporting this could you add your i3status.conf.

I don't have any custom i3status.conf. There is only the default one in /etc/i3status.conf

Thanks for reporting this @jurajpetrik !

Since a lot has changed on the i3status.conf parser since 3.0, would you please try by installing 3.1 and testing again first ?

Thanks !

getting this error from multiple modules, guess it is related

Instance sysdata, user method sysData failed (UnicodeDecodeError) sysdata.py line 153.
Instance mpd_status, user method current_track failed (UnicodeDecodeError) mpd_status.py line 92.

% py3status --version
py3status version 3.1 (python 2.7.10)

@YetAnotherNerd thanks for the report, could you share the config settings for those 2 modules.
It looks like a different issue to the original report but will need fixing up.

@ultrabug some of this should be fixed by the safe_format changes but some like mpd_status look like they will still need fixing though the fix will likely be '' -> u''

@tobes

mpd_status {
    hide_when_paused = true
    hide_when_stopped = true
    format = '[[[%artist% - ]%title%]|[%file%]]'
}
sysdata {
    format = 'CPU: {cpu_usage}% {cpu_temp}'
}

seems mpd_status only fails for some tracks
sysdata is working with default settings, looks like the {cpu_temp} part causing the issue

seems mpd_status only fails for some tracks

yeah ones where there is a unicode character

@ultrabug what do you feel about a 3.1.1 bugfix branch for things like this? The alternative is to just wait for 3.2. With sys_info it is more a pain as the fix would not just be a backport. Anyway something to think about.

@ultrabug what do you feel about a 3.1.1 bugfix branch for things like this?

sounds sensible to make a release for this, ok

From what I can tell sysdata module works in current master but not in 3.1

mpd_status uses it's own parser (due to it's % format among other things) I don't have mpd installed so can't really test it. Ultimately the best solution is going to be changing mpd_status to use Py3.safe_format() as that works around these unicode issues. However changing mpd_status will not be easy as

a) We need to decide what we do with the % stuff. Do we allow this for all modules, just for mpd_status or (my preferred option) remove the ability to do this in mpd_status so that we have uniformity across modules.

b) It has a slightly odd way of getting the values (on demand) rather than the more standard providing them to the formatter.

I'm going to amend the title of this issue to reflect this

I think we should fix mpd_status and produce a fork of the module that abides by the standards. I don't think we can make that breaking change lightly.

this has been fixed in #506

Was this page helpful?
0 / 5 - 0 ratings