After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 653187 - [im-status] 'ascii' codec can't decode byte outside range(128)
[im-status] 'ascii' codec can't decode byte outside range(128)
Status: RESOLVED FIXED
Product: rhythmbox
Classification: Other
Component: Plugins (other)
HEAD
Other Linux
: Normal normal
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-06-22 19:16 UTC by Claudio Saavedra
Modified: 2012-04-19 14:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[im-status] Do not assume 'ascii', or unicode() will fail (1.05 KB, patch)
2011-06-22 19:39 UTC, Claudio Saavedra
committed Details | Review
Perform unicode conversion on tag and status message retrieval with check for None (4.10 KB, patch)
2012-04-19 14:02 UTC, Nikolai Knopp
none Details | Review

Description Claudio Saavedra 2011-06-22 19:16:21 UTC
Seems to be something new in recent python versions:

Traceback (most recent call last):
  • File "/usr/lib64/rhythmbox/plugins/im-status/im-status.py", line 109 in playing_entry_changed
    self.set_entry (entry)
  • File "/usr/lib64/rhythmbox/plugins/im-status/im-status.py", line 138 in set_entry
    self.set_status_from_entry ()
  • File "/usr/lib64/rhythmbox/plugins/im-status/im-status.py", line 155 in set_status_from_entry
    self.set_status ()
  • File "/usr/lib64/rhythmbox/plugins/im-status/im-status.py", line 168 in set_status
    new_status = _(u"♫ %(artist)s - %(title)s ♫") % subs
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)


http://docs.python.org/howto/unicode.html
Comment 1 Claudio Saavedra 2011-06-22 19:39:14 UTC
Created attachment 190470 [details] [review]
[im-status] Do not assume 'ascii', or unicode() will fail
Comment 2 Claudio Saavedra 2011-06-22 19:41:43 UTC
I'm far from being a python expert but this works for me.
Comment 3 Jonathan Matthew 2011-06-25 08:01:17 UTC
Review of attachment 190470 [details] [review]:

looks good to me
Comment 4 Claudio Saavedra 2011-06-25 15:55:58 UTC
Attachment 190470 [details] pushed as f2a08e9 - [im-status] Do not assume 'ascii', or unicode() will fail
Comment 5 Nikolai Knopp 2012-04-19 14:01:25 UTC
Claudio's patch unfortunately causes the plugin to crash when a database entry has empty artist, album or title tags, like radio station entries. The call to unicode(...) complains about being fed None as an argument.

I'll attach a patch that performs a conversion of tags to unicode when they are extracted and stored in the current_xyz variables, making later conversions unnecessary. If a tag is empty, None is stored in its variable, as before.
It also converts cached status messages to unicode on retrieval, which would otherwise cause the plugin to crash upon reading a status message with unicode characters.
Comment 6 Nikolai Knopp 2012-04-19 14:02:41 UTC
Created attachment 212363 [details] [review]
Perform unicode conversion on tag and status message retrieval with check for None

Fixes a bug introduced by commit f2a08e99b8c0a75d092b5720e66288063820cbb9