Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mmdc not recognized as executable on windows #19

Open
mivanit opened this issue Jan 9, 2022 · 0 comments
Open

mmdc not recognized as executable on windows #19

mivanit opened this issue Jan 9, 2022 · 0 comments

Comments

@mivanit
Copy link

mivanit commented Jan 9, 2022

I've explicitly set MERMAID_BIN = 'path/to/mermaid-cli/node_modules/.bin/mmdc/ in the python code and tested that mmdc works when run from the shell. When trying to run the filter, I get

Traceback (most recent call last):
  File "f:\Gdrive\notes\tools\pandoc\filters\mermaid.py", line 57, in <module>
    main()
  File "f:\Gdrive\notes\tools\pandoc\filters\mermaid.py", line 53, in main
    toJSONFilter(mermaid)
  File "C:\Python\Python3_10\lib\site-packages\pandocfilters.py", line 148, in toJSONFilter
    toJSONFilters([action])
  File "C:\Python\Python3_10\lib\site-packages\pandocfilters.py", line 182, in toJSONFilters
    sys.stdout.write(applyJSONFilters(actions, source, format))
  File "C:\Python\Python3_10\lib\site-packages\pandocfilters.py", line 213, in applyJSONFilters
    altered = walk(altered, action, format, meta)
  File "C:\Python\Python3_10\lib\site-packages\pandocfilters.py", line 141, in walk
    return {k: walk(v, action, format, meta) for k, v in x.items()}
  File "C:\Python\Python3_10\lib\site-packages\pandocfilters.py", line 141, in <dictcomp>
    return {k: walk(v, action, format, meta) for k, v in x.items()}
  File "C:\Python\Python3_10\lib\site-packages\pandocfilters.py", line 128, in walk
    res = action(item['t'],
  File "f:\path\to\pandoc-mermaid-filter.py", line 46, in mermaid
    subprocess.check_call(cmd)
  File "C:\Python\Python3_10\lib\subprocess.py", line 364, in check_call
    retcode = call(*popenargs, **kwargs)
  File "C:\Python\Python3_10\lib\subprocess.py", line 345, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Python\Python3_10\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python\Python3_10\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 193] %1 is not a valid Win32 application

setting shell=True for subprocess.check_call fixes the issue, but this is probably not the most elegant solution. I'm not familiar with node.js so I'm not sure what exactly the problem might be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant