Open dbrgn opened 10 years ago
I'm getting the same errors. It seems to happen whenever Orochi tries to display some text (usually in the title of the mix) that doesn't fit in the ascii encoding. Easily reproducable by doing a search for something like (8tracks)> search russian
, which, after successfully displaying 7 results, gives:
Traceback (most recent call last):
File "/usr/local/bin/orochi", line 9, in <module>
load_entry_point('orochi==0.1.2', 'console_scripts', 'orochi')()
File "/usr/local/lib/python2.7/dist-packages/orochi/client.py", line 732, in main
client.cmdloop()
File "/usr/local/lib/python2.7/dist-packages/orochi/client.py", line 169, in cmdloop
super(Client, self).cmdloop()
File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
return func(arg)
File "/usr/local/lib/python2.7/dist-packages/orochi/client.py", line 210, in do_search
self.display_search_results(mixes, s)
File "/usr/local/lib/python2.7/dist-packages/orochi/client.py", line 457, in display_search_results
print(prefix + wrapper.fill(mix_info))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 9-10: ordinal not in range(128)
I've tried fixing the problem myself, but I'm too unfamiliar with either this project or character encoding in python in general to make any headway.
@realitychemist that doesn't occur in my case. Is your terminal set to UTF8? Can you post your export | egrep "LC|LANG"
output?
$ export | egrep "LC|LANG"
declare -x LANG="en_US.UTF-8"
declare -x LC_ALL=""
declare -x LC_COLLATE="C"
declare -x LC_CTYPE="en_US.UTF-8"
That's a setting I've not come across before, and in my case it outputs the rather confusing line:
declare -x LANG=""
and nothing else. I found the encoding settings for my terminal using the gui and set it to UTF-8 that way, but the output of the egrep didn't change. I'm now getting 8 results on the (8tracks)> search russian
query, but then it still fails with the same UnicodeEncodeError.
Addendum1: The result of a locale charmap
command is ANSI_X3.4-1968
Addendum2: I set the language on my terminal by:
export LC_ALL=en_US.utf8
export LANG="$LC_ALL"
and now everything is working fine! Thank you for pointing me in this direction.
@realitychemist yes, that was the correct way :) You can also put the export
lines in your .bashr
or .profile
files, so that they're always exported automatically.
Maybe I should add a check to Orochi to make sure that users have a terminal set to some unicode encoding.