From bd97135588f65c6799bc5c0c99bd7916efa6a3e2 Mon Sep 17 00:00:00 2001 From: Milka64 Date: Sun, 10 Dec 2023 22:11:18 +0100 Subject: [PATCH] convert str to byte for write tempfile --- sphinx_d2lang/d2lang.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx_d2lang/d2lang.py b/sphinx_d2lang/d2lang.py index e7e65d5..73c7359 100644 --- a/sphinx_d2lang/d2lang.py +++ b/sphinx_d2lang/d2lang.py @@ -17,7 +17,7 @@ class D2langDirective(Directive): diag_source = self.content with tempfile.NamedTemporaryFile() as fp: for line in self.content: - fp.write(line) + fp.write(bytes(line,'utf-8')) cmd_line = '%s %s %s' % (d2_bin, fp.name, srcdir + "/test.svg") args = shlex.split(cmd_line) subprocess.run(args)