Wenn Sie pandoc
direkt mit minimalem Beispiel kein Problem führen:subprocess.run nicht ordnungsgemäß ausgeführt pandoc
$ cat workfile.md
This is a **test** see ![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png)
$ pandoc workfile.md
<p>This is a <strong>test</strong> see <img src="https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png" alt="alt text" /></p>
Aber wenn Sie es über subprocess.run nennen, dann scheitert es. Dieses minimale Beispiel:
import subprocess, os
path = 'workfile.md'
contents = "This is a **test** see ![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png)"
with open(path, 'w') as f:
f.write(contents)
pbody = subprocess.run(["pandoc", "{}".format(path)], check=True, stdout=subprocess.PIPE)
print("**** pbody: ", pbody)
gibt uns
**** pbody: CompletedProcess(args=['pandoc', 'workfile.md'], returncode=0, stdout=b'\n')
'' subprocess.run'' macht genau, was es dokumentiert ist zu tun. '' subprocess.check_output'' scheint dem zu entsprechen, was Sie tun möchten. – jasonharper