mirror of
https://github.com/beetbox/beets.git
synced 2026-01-29 03:26:28 +01:00
deal with encoding issues in python3
when we encode explicitly, we return bytes, so open files as binary
This commit is contained in:
parent
f667428758
commit
0bcd16f1ab
1 changed files with 3 additions and 3 deletions
|
|
@ -726,7 +726,7 @@ class LyricsPlugin(plugins.BeetsPlugin):
|
|||
if self.rst is not None:
|
||||
slug = re.sub(r'\W+', '-', unidecode(self.artist).lower())
|
||||
path = os.path.join(directory, 'artists', slug + u'.rst')
|
||||
with open(path, 'w') as output:
|
||||
with open(path, 'wb') as output:
|
||||
output.write(self.rst.encode('utf-8'))
|
||||
self.rst = None
|
||||
if item is None:
|
||||
|
|
@ -761,7 +761,7 @@ class LyricsPlugin(plugins.BeetsPlugin):
|
|||
raise
|
||||
indexfile = os.path.join(directory, 'index.rst')
|
||||
if not os.path.exists(indexfile):
|
||||
with open(indexfile, 'w') as output:
|
||||
with open(indexfile, 'wb') as output:
|
||||
output.write(u'''Lyrics
|
||||
======
|
||||
|
||||
|
|
@ -778,7 +778,7 @@ Artist index:
|
|||
''')
|
||||
conffile = os.path.join(directory, 'conf.py')
|
||||
if not os.path.exists(conffile):
|
||||
with open(conffile, 'w') as output:
|
||||
with open(conffile, 'wb') as output:
|
||||
output.write(u'''# -*- coding: utf-8 -*-
|
||||
master_doc = 'index'
|
||||
project = u'Lyrics'
|
||||
|
|
|
|||
Loading…
Reference in a new issue