mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 11:52:01 +00:00
Use encode() in zerver/lib/tex.py.
This commit is contained in:
@@ -4,7 +4,6 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from typing import Optional, Text
|
from typing import Optional, Text
|
||||||
from zerver.lib.str_utils import force_bytes
|
|
||||||
|
|
||||||
def render_tex(tex, is_inline=True):
|
def render_tex(tex, is_inline=True):
|
||||||
# type: (Text, bool) -> Optional[Text]
|
# type: (Text, bool) -> Optional[Text]
|
||||||
@@ -32,7 +31,7 @@ def render_tex(tex, is_inline=True):
|
|||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
stdout = katex.communicate(input=force_bytes(tex))[0]
|
stdout = katex.communicate(input=tex.encode())[0]
|
||||||
if katex.returncode == 0:
|
if katex.returncode == 0:
|
||||||
# stdout contains a newline at the end
|
# stdout contains a newline at the end
|
||||||
assert stdout is not None
|
assert stdout is not None
|
||||||
|
|||||||
Reference in New Issue
Block a user