mgaitan/sphinxcontrib-mermaid

Lack of encode() call generates errors in render_mm()

wlievens opened this issue · 2 comments

Lack of encode() call generates errors in render_mm()

I'm not sure exactly why, but I get this error when using the new 0.6.0:

  Exception occurred:
    File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 958, in _stdin_write
      self.stdin.write(input)
  TypeError: a bytes-like object is required, not 'str'

The root cause stack trace log produced by sphinx leads me to:

...lib\site-packages\sphinxcontrib\mermaid.py", line 191, in render_mm
    stdout, stderr = p.communicate(code)

I believe it is due to the change in this commit linked below, because when I hack in an encode("utf-8") call it works fine again.

6dbbf38#diff-b760861ad44d628f879c0d6e15c71c85ff086c1bbd530a006920c6ab38154ca7L172

For now I will try and revert to 0.5.0 but it would be better if this were fixed :-)

@wlievens does it still happen with the latest version? I guess it was fixed but I don't have a windows machine to try.

Seems to be fixed, thanks!