markdown-inline-graphviz icon indicating copy to clipboard operation
markdown-inline-graphviz copied to clipboard

Error : a bytes-like object is required, not 'str' : ['dot', '-Tsvg']

Open CesMak opened this issue 6 years ago • 3 comments

Hey If I try your example with mkdocs material I get this error:

Error : a bytes-like object is required, not 'str' : ['dot', '-Tsvg']

For this code: {% dot attack_plan.svg digraph G { rankdir=LR Earth [peripheries=2] Mars Earth -> Mars } %}

I also tried to incooperate it like this:

```graphviz
digraph finite_state_machine {
    rankdir=LR;
    size="8,5"

    node [shape = doublecircle]; S;
    node [shape = point ]; qi

    node [shape = circle];
    qi -> S;
    S  -> q1 [ label = "a" ];
    S  -> S  [ label = "a" ];
    q1 -> S  [ label = "a" ];
    q1 -> q2 [ label = "ddb" ];
    q2 -> q1 [ label = "b" ];
    q2 -> q2 [ label = "b" ];
}

CesMak avatar Oct 10 '18 19:10 CesMak

The latest version on PyPI doesn't contain the latest merge for 3.x.

I resolved with:

pip install git+https://github.com/sprin/markdown-inline-graphviz.git@9664863b3002d88243c9ee5e14c195e037e54618#egg=markdown-inline-graphviz

& mkdocs.yml:

markdown_extensions:
  - mdx_inline_graphviz

That's not an ideal solution.
I'm not sure if @sprin plans on pushing to PyPI, or if there are other options. I'm relatively new to Python and I'm reading Package documentation for the first time.

WesRoach avatar Oct 25 '18 23:10 WesRoach

I had the same problem and decided to upload a new package to Pypi. You can install it with:

pip3 install markdown_inline_graphviz_extension --user

and in your mkdocs.yml file:

markdown_extensions:
  - markdown_inline_graphviz:

cesaremorel avatar Jun 06 '19 03:06 cesaremorel

For future readers, the fix is a change in the mdx_inline_graphviz.py file

72c72
<                     proc.stdin.write(content)
---
>                     proc.stdin.write(str.encode(content))

jidn avatar Aug 03 '20 14:08 jidn