Skip to content

Commit

Permalink
Fix UTF-8 encoding error in translation server (python2 only) (OpenNM…
Browse files Browse the repository at this point in the history
  • Loading branch information
pltrdy authored and vince62s committed Mar 5, 2019
1 parent d6870f9 commit 90023eb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion onmt/translate/translation_server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
"""REST Translation server."""
from __future__ import print_function
import codecs
import sys
import os
import time
Expand Down Expand Up @@ -277,7 +278,8 @@ def load(self):
try:
self.translator = build_translator(self.opt,
report_score=False,
out_file=open(os.devnull, "w"))
out_file=codecs.open(
os.devnull, "w", "utf-8"))
except RuntimeError as e:
raise ServerModelError("Runtime Error: %s" % str(e))

Expand Down

0 comments on commit 90023eb

Please sign in to comment.