Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio.on_error() doing decode() on something already str #1851

Closed
jodal opened this issue Nov 30, 2019 · 0 comments · Fixed by #1853
Closed

Audio.on_error() doing decode() on something already str #1851

jodal opened this issue Nov 30, 2019 · 0 comments · Fixed by #1853
Assignees
Labels
A-audio Area: Audio layer C-bug Category: This is a bug
Milestone

Comments

@jodal
Copy link
Member

jodal commented Nov 30, 2019

Triggered by normal playback:

Traceback (most recent call last):
  File "/home/jodal/mopidy-dev/mopidy/mopidy/audio/actor.py", line 219, in on_message
    self.on_error(error, debug)
  File "/home/jodal/mopidy-dev/mopidy/mopidy/audio/actor.py", line 328, in on_error
    error_msg = str(error).decode()
AttributeError: 'str' object has no attribute 'decode'
@jodal jodal added C-bug Category: This is a bug A-audio Area: Audio layer labels Nov 30, 2019
@jodal jodal added this to the v3.0 milestone Nov 30, 2019
jodal added a commit to jodal/mopidy that referenced this issue Dec 13, 2019
On Python 2, we used str(error) to get a native string representation,
aka bytes, and then used .decode() on that to get a unicode string.

On Python 3, the str(error) call returns Unicode, which doesn't have a
.decode() method, so the error/warning handler crashes.

I added ipdb tracing, provoked an error, and investigated the objects we
get from GStreamer:

- `error` is an GLib.GError which has a good str()/repr(), as well as
  .message, .domain, and .code attributes.
- `debug` is a string

There were no traces of bytes that needed decoding in the objects.

Fixes mopidy#1851
@jodal jodal self-assigned this Dec 13, 2019
jodal added a commit to jodal/mopidy that referenced this issue Dec 13, 2019
On Python 2, we used str(error) to get a native string representation,
aka bytes, and then used .decode() on that to get a unicode string.

On Python 3, the str(error) call returns Unicode, which doesn't have a
.decode() method, so the error/warning handler crashes.

I added ipdb tracing, provoked an error, and investigated the objects we
get from GStreamer:

- `error` is an GLib.GError which has a good str()/repr(), as well as
  .message, .domain, and .code attributes.
- `debug` is a string

There were no traces of bytes that needed decoding in the objects.

Fixes mopidy#1851
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-audio Area: Audio layer C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant