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

'ascii' codec can't decode byte 0xc3 in position 15 #256

Closed
jcerdan opened this Issue Nov 21, 2012 · 5 comments

Comments

2 participants
@jcerdan

jcerdan commented Nov 21, 2012

I can't start mopidy in ArchLinux 64 bits. I can't find anything on Google and on this issue tracker.

Here's the output:

[jcerdan@nan ~]$ mopidy
** Message: pygobject_register_sinkfunc is deprecated (GstObject)
INFO     Starting Mopidy 0.9.0
INFO     Platform: Linux-3.6.6-1-ARCH-x86_64-with-glibc2.2.5
INFO     Python: CPython 2.7.3
ERROR    'ascii' codec can't decode byte 0xc3 in position 15: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/mopidy/__main__.py", line 60, in main
    backends = setup_backends(audio)
  File "/usr/lib/python2.7/site-packages/mopidy/__main__.py", line 153, in setup_backends
    backend = backend_class.start(audio=audio).proxy()
  File "/usr/lib/python2.7/site-packages/pykka/actor.py", line 95, in start
    obj = cls(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/mopidy/backends/local/actor.py", line 19, in __init__
    self.library = LocalLibraryProvider(backend=self)
  File "/usr/lib/python2.7/site-packages/mopidy/backends/local/library.py", line 18, in __init__
    self.refresh()
  File "/usr/lib/python2.7/site-packages/mopidy/backends/local/library.py", line 22, in refresh
    settings.LOCAL_TAG_CACHE_FILE, settings.LOCAL_MUSIC_PATH)
  File "/usr/lib/python2.7/site-packages/mopidy/utils/settings.py", line 64, in __getattr__
    value = path.expand_path(value)
  File "/usr/lib/python2.7/site-packages/mopidy/utils/path.py", line 74, in expand_path
    path = string.Template(path).safe_substitute(XDG_DIRS)
  File "/usr/lib/python2.7/string.py", line 205, in safe_substitute
    return self.pattern.sub(convert, self.template)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 15: ordinal not in range(128)
INFO     Audio output set to "oss4sink"
INFO     Audio mixer set to "alsamixer" using track "Maestro"

and

[jcerdan@nan ~]$ mopidy --list-deps
** Message: pygobject_register_sinkfunc is deprecated (GstObject)
Platform: Linux-3.6.6-1-ARCH-x86_64-with-glibc2.2.5
Python: CPython 2.7.3
  Imported from: /usr/lib/python2.7
GStreamer: 0.10.36.0
  Imported from: /usr/lib/python2.7/site-packages/gst-0.10/gst
  Other: 
    Python wrapper: gst-python 0.10.22.0
    Relevant elements:
      uridecodebin: OK
      souphttpsrc: OK
      appsrc: OK
      alsamixer: OK
      alsasink: OK
      ossmixer: OK
      osssink: OK
      oss4mixer: OK
      oss4sink: OK
      pulsemixer: OK
      pulsesink: OK
      mp3parse: OK
      mad: OK
      id3demux: OK
      id3v2mux: OK
      lame: OK
      vorbisdec: OK
      vorbisenc: OK
      vorbisparse: OK
      oggdemux: OK
      oggmux: OK
      oggparse: OK
      flacdec: OK
      flacparse: OK
      shout2send: OK
Pykka: 1.0.0
  Imported from: /usr/lib/python2.7/site-packages/pykka
pyspotify: 1.9
  Imported from: /usr/lib/python2.7/site-packages/spotify
  Other: Built for libspotify API version 12
pylast: not found
dbus-python: 1.1.1
  Imported from: /usr/lib/python2.7/site-packages/dbus
pyserial: not found

is there a bug?

@jodal

This comment has been minimized.

Member

jodal commented Nov 21, 2012

I guess you have a setting which contains a non-ASCII character. Try the following:

  1. Make sure all strings are prefixed with u, like: u'/home/æøå'
  2. If that doesn't help you, add # encoding: utf-8 to the first line of the file

If the first suggestion doesn't fix it, I'd like to hear back from you so that I can improve the docs.

@jcerdan

This comment has been minimized.

jcerdan commented Nov 21, 2012

Hi, all vars are prefixed with u. I have added the encofing but the output is the same:

[jcerdan@nan ~]$ mopidy
** Message: pygobject_register_sinkfunc is deprecated (GstObject)
INFO     Starting Mopidy 0.9.0
INFO     Platform: Linux-3.6.6-1-ARCH-x86_64-with-glibc2.2.5
INFO     Python: CPython 2.7.3
ERROR    'ascii' codec can't decode byte 0xc3 in position 15: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/mopidy/__main__.py", line 60, in main
    backends = setup_backends(audio)
  File "/usr/lib/python2.7/site-packages/mopidy/__main__.py", line 153, in setup_backends
    backend = backend_class.start(audio=audio).proxy()
  File "/usr/lib/python2.7/site-packages/pykka/actor.py", line 95, in start
    obj = cls(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/mopidy/backends/local/actor.py", line 19, in __init__
    self.library = LocalLibraryProvider(backend=self)
  File "/usr/lib/python2.7/site-packages/mopidy/backends/local/library.py", line 18, in __init__
    self.refresh()
  File "/usr/lib/python2.7/site-packages/mopidy/backends/local/library.py", line 22, in refresh
    settings.LOCAL_TAG_CACHE_FILE, settings.LOCAL_MUSIC_PATH)
  File "/usr/lib/python2.7/site-packages/mopidy/utils/settings.py", line 64, in __getattr__
    value = path.expand_path(value)
  File "/usr/lib/python2.7/site-packages/mopidy/utils/path.py", line 74, in expand_path
    path = string.Template(path).safe_substitute(XDG_DIRS)
  File "/usr/lib/python2.7/string.py", line 205, in safe_substitute
    return self.pattern.sub(convert, self.template)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 15: ordinal not in range(128)
INFO     Audio output set to "oss4sink"
INFO     Audio mixer set to "alsamixer" using track "Maestro"

Here is my settings file:

[jcerdan@nan ~]$ cat .config/mopidy/settings.py
# encoding: utf-8
OUTPUT = u'oss4sink'
MPD_SERVER_HOSTNAME = u'::'
SPOTIFY_USERNAME = u'jcerdan@tecob.com'
SPOTIFY_PASSWORD = u'password'

Even if I remove the settings file and runs mopidy alone, the same error appears.

@jodal

This comment has been minimized.

Member

jodal commented Nov 21, 2012

Ok, everything looks good in your settings file.

Could you run the python interactive shell and do the same as I do here, and paste the result?

$ python
Python 2.7.3 (default, Apr 10 2012, 12:29:04) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import glib
>>> glib.get_user_cache_dir()
'/home/jodal/.cache'
>>> glib.get_user_data_dir()
'/home/jodal/.local/share'
>>> glib.get_user_special_dir(glib.USER_DIRECTORY_MUSIC)
'/home/jodal'
>>> 
@jcerdan

This comment has been minimized.

jcerdan commented Nov 21, 2012

in Archlinux default python is python 3.x
in mopidy file I can see that it forces python2, so that should not be the problem.

Here's the output...

  [jcerdan@nan ~]$ python2
  Python 2.7.3 (default, Apr 24 2012, 00:00:54) 
  [GCC 4.7.0 20120414 (prerelease)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import glib
  >>> glib.get_user_cache_dir()
  '/home/jcerdan/.cache'
  >>> glib.get_user_data_dir()
  '/home/jcerdan/.local/share'
  >>> glib.get_user_special_dir(glib.USER_DIRECTORY_MUSIC)
  '/home/jcerdan/M\xc3\xbasica'

... I think you have found the problem, isn't it?

How to correct it?

@jodal

This comment has been minimized.

Member

jodal commented Nov 21, 2012

You can work around it by setting the LOCAL_MUSIC_PATH setting to anything not including $XDG_MUSIC_DIR.

I'll have to consider if we should do a bug fix release in a day or two to get a fix for this out.

@jodal jodal closed this in 26e6b2e Nov 21, 2012

jodal added a commit that referenced this issue Nov 21, 2012

Improve fix for #256
- Forgot to decode result from glib.get_user_config_dir()
- glib.USER_DIRECTORY_MUSIC isn't always defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment