Add explicit utf-8 encoding for file I/O in test_api.py

This commit is contained in:
Chris Howell 2020-10-08 13:36:33 -07:00
parent 77e8137769
commit eb01e08b04
1 changed files with 4 additions and 1 deletions

View File

@ -21,7 +21,10 @@ from youtube_transcript_api import (
def load_asset(filename): def load_asset(filename):
with open('{dirname}/assets/{filename}'.format(dirname=os.path.dirname(__file__), filename=filename)) as file: filepath = '{dirname}/assets/{filename}'.format(
dirname=os.path.dirname(__file__), filename=filename)
with open(filepath, encoding='utf-8') as file:
return file.read() return file.read()