timofurrer / pandoc-mermaid-filter

Pandoc filter for mermaid code blocks
MIT License
74 stars 21 forks source link

No such file or directory: 'mermaid' #16

Open ebsd opened 3 years ago

ebsd commented 3 years ago

Hi !

I installed mermaid-cli: npm install mermaid.cli I set the variable MERMAID_BIN='~/node_modules/.bin/mmdc' I installed pandoc-mermaid-filter : pip install pandoc-mermaid-filter --user

When I run pandoc, I get : FileNotFoundError: [Errno 2] No such file or directory: 'mermaid'

Can you help me ?

$ pandoc test.md -o test.pdf --filter pandoc-mermaid
Traceback (most recent call last):
  File "/home/ebsd/.local/bin/pandoc-mermaid", line 8, in <module>
    sys.exit(main())
  File "/home/ebsd/.local/lib/python3.8/site-packages/pandoc_mermaid_filter.py", line 38, in main
    toJSONFilter(mermaid)
  File "/home/ebsd/.local/lib/python3.8/site-packages/pandocfilters.py", line 130, in toJSONFilter
    toJSONFilters([action])
  File "/home/ebsd/.local/lib/python3.8/site-packages/pandocfilters.py", line 164, in toJSONFilters
    sys.stdout.write(applyJSONFilters(actions, source, format))
  File "/home/ebsd/.local/lib/python3.8/site-packages/pandocfilters.py", line 195, in applyJSONFilters
    altered = walk(altered, action, format, meta)
  File "/home/ebsd/.local/lib/python3.8/site-packages/pandocfilters.py", line 123, in walk
    return {k: walk(v, action, format, meta) for k, v in x.items()}
  File "/home/ebsd/.local/lib/python3.8/site-packages/pandocfilters.py", line 123, in <dictcomp>
    return {k: walk(v, action, format, meta) for k, v in x.items()}
  File "/home/ebsd/.local/lib/python3.8/site-packages/pandocfilters.py", line 110, in walk
    res = action(item['t'],
  File "/home/ebsd/.local/lib/python3.8/site-packages/pandoc_mermaid_filter.py", line 31, in mermaid
    subprocess.check_call([MERMAID_BIN, "-i", src, "-o", dest])
  File "/usr/lib/python3.8/subprocess.py", line 359, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'mermaid'
Error running filter pandoc-mermaid:
Filter returned error status 1
presteus commented 3 years ago

Same issue for me

find . -name '*.md' -exec sh -c 'pandoc -s -f markdown -t pdf -F pandoc-mermaid -o $0.pdf $0' {} \;
Created directory mermaid-images
Traceback (most recent call last):
  File "/usr/local/bin/pandoc-mermaid", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/pandoc_mermaid_filter.py", line 38, in main
    toJSONFilter(mermaid)
  File "/usr/local/lib/python3.9/site-packages/pandocfilters.py", line 130, in toJSONFilter
    toJSONFilters([action])
  File "/usr/local/lib/python3.9/site-packages/pandocfilters.py", line 164, in toJSONFilters
    sys.stdout.write(applyJSONFilters(actions, source, format))
  File "/usr/local/lib/python3.9/site-packages/pandocfilters.py", line 195, in applyJSONFilters
    altered = walk(altered, action, format, meta)
  File "/usr/local/lib/python3.9/site-packages/pandocfilters.py", line 123, in walk
    return {k: walk(v, action, format, meta) for k, v in x.items()}
  File "/usr/local/lib/python3.9/site-packages/pandocfilters.py", line 123, in <dictcomp>
    return {k: walk(v, action, format, meta) for k, v in x.items()}
  File "/usr/local/lib/python3.9/site-packages/pandocfilters.py", line 110, in walk
    res = action(item['t'],
  File "/usr/local/lib/python3.9/site-packages/pandoc_mermaid_filter.py", line 31, in mermaid
    subprocess.check_call([MERMAID_BIN, "-i", src, "-o", dest])
  File "/usr/local/lib/python3.9/subprocess.py", line 368, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/local/lib/python3.9/subprocess.py", line 349, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/local/lib/python3.9/subprocess.py", line 947, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.9/subprocess.py", line 1819, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'mermaid'
Error running filter pandoc-mermaid:
Filter returned error status 1
cannyboy commented 3 years ago

ditto. macOS 10.11

zyberzebra commented 3 years ago

any updates ?

kiedanski commented 3 years ago

Changing this line

mermaid in the following line to mmcd worked for me

MERMAID_BIN = os.path.expanduser(os.environ.get('MERMAID_BIN', 'mermaid'))