markdown-inline-graphviz
markdown-inline-graphviz copied to clipboard
Error : a bytes-like object is required, not 'str' : ['dot', '-Tsvg']
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" ];
}
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.
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:
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))