Browse Source

Properly detect yaml encoding

pull/198/head
Oliverpool 9 years ago
parent
commit
73d101ade5
  1. 4
      patacrep/songbook/__main__.py

4
patacrep/songbook/__main__.py

@ -137,10 +137,10 @@ def main():
try: try:
with patacrep.encoding.open_read(songbook_path) as songbook_file: with patacrep.encoding.open_read(songbook_path) as songbook_file:
user_songbook = yaml.load(songbook_file) user_songbook = yaml.load(songbook_file)
if 'encoding' in user_songbook: if 'encoding' in user_songbook.get('book', []):
with patacrep.encoding.open_read( with patacrep.encoding.open_read(
songbook_path, songbook_path,
encoding=user_songbook['encoding'] encoding=user_songbook['book']['encoding']
) as songbook_file: ) as songbook_file:
user_songbook = yaml.load(songbook_file) user_songbook = yaml.load(songbook_file)
except Exception as error: # pylint: disable=broad-except except Exception as error: # pylint: disable=broad-except

Loading…
Cancel
Save