open lastgenre genres file with codecs.open()

This should fix an error when decoding the file on Windows. It defaults
to using the code page there and not utf-8 as intended for yaml.
This commit is contained in:
Johnny Robeson 2016-07-17 05:57:52 -04:00
parent 1ee7a3e2f1
commit 1da919bc40

View file

@ -25,6 +25,7 @@ The scraper script used is available here:
https://gist.github.com/1241307
"""
import pylast
import codecs
import os
import yaml
import traceback
@ -140,7 +141,8 @@ class LastGenrePlugin(plugins.BeetsPlugin):
c14n_filename = C14N_TREE
if c14n_filename:
c14n_filename = normpath(c14n_filename)
genres_tree = yaml.load(open(c14n_filename, 'r'))
genres_file = codecs.open(c14n_filename, 'r', encoding='utf-8')
genres_tree = yaml.load(genres_file)
flatten_tree(genres_tree, [], self.c14n_branches)
@property