ralfonso / theory

Python web based MPD client with a pretty face and some ajax where it makes sense
http://theory.steelbreeze.org/
MIT License
34 stars 12 forks source link

UnicodeDecodeError after logging in. Shows my music, but not what's playing #9

Open disassembler opened 12 years ago

disassembler commented 12 years ago

Hey all,

I've been trying to hack at making this work with python2.7. See below for what I did so far.

Let me know if there's any other output I can give you to help debug this issue.

Modified install.sh to not use built-in pylons installer script but get it from pypi instead:


diff --git a/install.sh b/install.sh
index add0ca7..82fb582 100755
--- a/install.sh
+++ b/install.sh
@@ -8,6 +8,13 @@ then
 fi

 echo "installing theory prerequisites and Python virtual environment to $SELF/e
-python go-pylons.py --no-site-packages "$SELF/env/" &&
+#python go-pylons.py --no-site-packages "$SELF/env/" &&
+if [ ! -f "$SELF/env/bin/activate" ]
+then
+  virtualenv $SELF/env
+else
+  source $SELF/env/bin/activate
+fi
+"$SELF/env/bin/easy_install" Pylons==1.0
 "$SELF/env/bin/easy_install" python-mpd

Fix run script to work since paster doesn't allow daemon and reload flag specified at same time:


diff --git a/run-theory.sh b/run-theory.sh
index 1e48e2c..08eb1aa 100755
--- a/run-theory.sh
+++ b/run-theory.sh
@@ -11,7 +11,7 @@ start() {
                exit
        fi
        echo "starting theory"
-       "$SELF/env/bin/paster" serve --daemon --reload --log-file "$SELF/theory.
+       "$SELF/env/bin/paster" serve --daemon --log-file "$SELF/theory.log" "$SE
 }

 stop() {

This is the output in the web browser once I login:


WebError Traceback:
⇝ UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 65: ordinal not in range(128)
View as:   Interactive (full)  |  Text (full)  |  XML (full)
Module theory.controllers.playlist:48 in index         view
>>  return render('/playlist.html')
Module pylons.templating:243 in render_mako         view
>>  cache_type=cache_type, cache_expire=cache_expire)
Module pylons.templating:218 in cached_template         view
>>  return render_func()
Module pylons.templating:240 in render_template         view
>>  return literal(template.render_unicode(**globs))
Module mako.template:406 in render_unicode         view
>>  as_unicode=True)
Module mako.runtime:764 in _render         view
>>  **_kwargs_for_callable(callable_, data))
Module mako.runtime:796 in _render_context         view
>>  _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
Module mako.runtime:822 in _exec_template         view
>>  callable_(context, *args, **kwargs)
Module _body_html:47 in render_body         view
>>  __M_writer(escape(self.body()))
Module _playlist_html:83 in render_body         view
>>  __M_writer(escape(display_title))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 65: ordinal not in range(128)
spookylukey commented 11 years ago

I fixed this in my fork, by using python-mpd2 and unicode throughout (converting to bytestrings when needed, rather than the other way around).

Commits: https://github.com/spookylukey/theory/commit/90dc3c196f6b7597d40bca0609c7207500955fc6 https://github.com/spookylukey/theory/commit/0d8a06a6c5a7b4ef541c9529391bb89a1d1faa4d