You are using the cmd
in Windows? In that case it might be a bit of a hack to get Unicode working at all to display correctly.
You might want to think about using another "terminal" to test your scripts.
MSYS provides a nice terminal/shell and IDLE is included in the Windows Python distribution and has a Python Shell (right click, open in IDLE, F5).
If you really want to make it work in the cmd
:
You have to set Lucida Console
as font in cmd
. Then:
> chcp
Active code page: 850
> chcp 65001
Then you should have unicode output in the cmd
. Your "Active code page" might be different. Note that somewhere, because you might want to change it back afterwards:
> chcp 850
Otherwise you will run into other problems (starting .bat
files doesn't work).
(See also batch-file-encoding)
In your script you also need this:
import codecs
def cp65001(name):
"""This might be buggy, but better than just a LookupError
"""
if name.lower() == "cp65001":
return codecs.lookup("utf-8")
codecs.register(cp65001)
Otherwise python will crash. (see windows-cmd-encoding-change-causes-python-crash)
I had a similar bug report for my script.
You might also consider using a library to access the MusicBrainz Web Service. Python-musicbrainzngs works with the current ws/2.