Skip to content

Commit 57c15c5

Browse files
committed
tests : avoid crashing on non-UTF-8 characters
Based on feedback from Daniel Bevenius. Add 'errors' parameter to open() in order to avoid unhandled exception on invalid UTF-8 bytes. Signed-off-by: Fujimoto Seiji <[email protected]>
1 parent eb2d0ef commit 57c15c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/earnings21/eval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def get_reference():
2020
def get_hypothesis():
2121
hyp = {}
2222
for path in glob.glob("speech-datasets/earnings21/media/*.mp3.txt"):
23-
with open(path) as fp:
23+
with open(path, errors='ignore') as fp:
2424
text = fp.read().strip()
2525
code = os.path.basename(path).replace(".mp3.txt", "")
2626
hyp[code] = text

0 commit comments

Comments
 (0)