Use encode() in zerver/lib/tex.py.

This commit is contained in:
Steve Howell
2017-11-04 09:01:28 -07:00
committed by Tim Abbott
parent 7821cb3d51
commit 64dc9e65cf

View File

@@ -4,7 +4,6 @@ import os
import subprocess
from django.conf import settings
from typing import Optional, Text
from zerver.lib.str_utils import force_bytes
def render_tex(tex, is_inline=True):
# type: (Text, bool) -> Optional[Text]
@@ -32,7 +31,7 @@ def render_tex(tex, is_inline=True):
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout = katex.communicate(input=force_bytes(tex))[0]
stdout = katex.communicate(input=tex.encode())[0]
if katex.returncode == 0:
# stdout contains a newline at the end
assert stdout is not None