Bug#1077793: pandoc: Pandoc trying to use python2 for filter
Package: pandoc
Version: 3.1.3+ds-3
Severity: normal
Dear Maintainer,
It appears that pandoc will try execute the binary 'python' when running
a .py filter, when it should be using 'python3'. This only occurs when
calling a non-executable python filter, so a workaround is to have the
executable bit set on the filter.
I have verified that this occurs in unstable too.
Example:
$ pandoc -F ./abc.py abc-sample.md
Error running filter ./abc.py:
Could not find executable python
abc.py
-------
#!/usr/bin/env python3
"""
Pandoc filter to process code blocks with class "abc" containing
ABC notation into images. Assumes that abcm2ps and ImageMagick's
convert are in the path. Images are put in the abc-images directory.
"""
import os
import sys
from subprocess import Popen, PIPE, call
from pandocfilters import toJSONFilter, Para, Image, get_caption, get_filename4code, get_extension
def abc2eps(abc_src, filetype, outfile):
p = Popen(["abcm2ps", "-O", outfile + '.eps', "-"], stdin=PIPE)
p.stdin.write(abc_src)
p.communicate()
p.stdin.close()
call(["convert", outfile + '.eps', outfile + '.' + filetype])
def abc(key, value, format, _):
if key == 'CodeBlock':
[[ident, classes, keyvals], code] = value
if "abc" in classes:
caption, typef, keyvals = get_caption(keyvals)
outfile = get_filename4code("abc", code)
filetype = get_extension(format, "png", html="png", latex="pdf")
dest = outfile + '.' + filetype
if not os.path.isfile(dest):
abc2eps(code.encode("utf-8"), filetype, outfile)
sys.stderr.write('Created image ' + dest + '\n')
return Para([Image([ident, [], keyvals], caption, [dest, typef])])
if __name__ == "__main__":
toJSONFilter(abc)
abc-sample.md
-------------
Use this
```
X:7
T:Qui Tolis (Trio)
C:André Raison
M:3/4
L:1/4
Q:1/4=92
%%staves {(Pos1 Pos2) Trompette}
K:F
%
V:Pos1
%%MIDI program 78
"Positif"x3 |x3 |c'>ba|Pga/g/f|:g2a |ba2 |g2c- |c2P=B |c>de |fga |
V:Pos2
%%MIDI program 78
Mf>ed|cd/c/B|PA2d |ef/e/d |:e2f |ef2 |c>BA |GA/G/F |E>FG |ABc- |
V:Trompette
%%MIDI program 56
"Trompette"z3|z3 |z3 |z3 |:Mc>BA|PGA/G/F|PE>EF|PEF/E/D|C>CPB,|A,G,F,-|
```
to get
```abc
X:7
T:Qui Tolis (Trio)
C:André Raison
M:3/4
L:1/4
Q:1/4=92
%%staves {(Pos1 Pos2) Trompette}
K:F
%
V:Pos1
%%MIDI program 78
"Positif"x3 |x3 |c'>ba|Pga/g/f|:g2a |ba2 |g2c- |c2P=B |c>de |fga |
V:Pos2
%%MIDI program 78
Mf>ed|cd/c/B|PA2d |ef/e/d |:e2f |ef2 |c>BA |GA/G/F |E>FG |ABc- |
V:Trompette
%%MIDI program 56
"Trompette"z3|z3 |z3 |z3 |:Mc>BA|PGA/G/F|PE>EF|PEF/E/D|C>CPB,|A,G,F,-|
```
See [(this is a link to whatever)](#whatever) for an example with options
`{.abc #whatever caption="this is the caption" width=50%}`.
```{.abc #whatever caption="this is the caption" width=50%}
X:7
T:Qui Tolis (Trio)
C:André Raison
M:3/4
L:1/4
Q:1/4=92
%%staves {(Pos1 Pos2) Trompette}
K:F
%
V:Pos1
%%MIDI program 78
"Positif"x3 |x3 |c'>ba|Pga/g/f|:g2a |ba2 |g2c- |c2P=B |c>de |fga |
V:Pos2
%%MIDI program 78
Mf>ed|cd/c/B|PA2d |ef/e/d |:e2f |ef2 |c>BA |GA/G/F |E>FG |ABc- |
V:Trompette
%%MIDI program 56
"Trompette"z3|z3 |z3 |z3 |:Mc>BA|PGA/G/F|PE>EF|PEF/E/D|C>CPB,|A,G,F,-|
```
-- System Information:
Debian Release: 12.6
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.1.0-23-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages pandoc depends on:
ii libc6 2.36-9+deb12u7
ii libffi8 3.4.4-1
ii libgmp10 2:6.2.1+dfsg1-1.1
ii liblua5.3-0 5.3.6-2
ii libyaml-0-2 0.2.5-1
ii pandoc-data 2.17.1.1-2~deb12u1
ii zlib1g 1:1.2.13.dfsg-1
pandoc recommends no packages.
Versions of packages pandoc suggests:
pn citation-style-language-styles <none>
pn context <none>
pn ghc <none>
pn groff <none>
pn libjs-katex <none>
pn libjs-mathjax <none>
pn librsvg2-bin <none>
pn nodejs <none>
pn pandoc-citeproc <none>
ii perl 5.36.0-7+deb12u1
pn php <none>
pn python <none>
pn r-base-core <none>
ii ruby 1:3.1
pn texlive-latex-extra <none>
pn texlive-latex-recommended <none>
pn texlive-luatex <none>
pn texlive-xetex <none>
pn wkhtmltopdf <none>
-- no debconf information
Reply to: