I have installed pandoc.exe 2.10 with the Windows installer, and I am calling it from cygwin 3.1.6-1. Unlike most other commands, pandoc seems to have troubles with certain paths. I get an error “openBinaryFile: does not exist (No such file or directory)” when the input or output file paths include one of the following:
~
, e.g. ~/myfile.md
./cygdrive
, e.g. /cygdrive/c/Users/me/myfile.md
.//server/path/myfile.md
.By contrast, paths that include the following work:
c:/Users/me/myfile.md
../myfile.md
or simply myfile.md
.\\server\path\myfile.md
.Why is that? Why is pandoc’s behaviour different from other commands?
Most Google hits for the error message relate to R Markdown. In the JDK build-dev mailing list, the problem was related to pandoc not being a native cygwin app (see CR: 8180540: Add pandoc build fix for windows).
As /u/matzeri has said (thanks!), it is because Windows pandoc
is a Windows program and does not recognize Cygwin path styles.
A reliable way to fix this might be using cygpath
with the --absolute
and --mixed
flags, like so:
pandoc "$(cygpath -am path/to/file.md)" -o "$(cygpath -am path/to/other_file.html)"